Realistically, what I want to create is something that allows me to define a dependency chain for static libraries so that the final executable developer does not need to worry about the dependencies. I should be able to abstract this away into a module.
On Fri, Dec 18, 2009 at 2:45 PM, Roman Shtylman <shtyl...@gmail.com> wrote: > In my setup I have statically linked libraries, thus the library > dependencies are not automatically pulled in. I suppose I can do some > things with ldd to determine which libraries are needed. Initially, to > make things simple, if libA used libB and libC (all statically linked) > then when linking an executable against libA I will want to also link > against libB and C. > > On Fri, Dec 18, 2009 at 11:54 AM, Jed Brown <j...@59a2.org> wrote: >> On Fri, 18 Dec 2009 10:19:05 +0100, "Marcel Loose" <lo...@astron.nl> wrote: >>> Hi Roman, >>> >>> Not in a portable way. I'm not too familiar with Windows, but on Linux >>> you can do this when libA is a shared library that has its dependency on >>> libB linked in (e.g. ldd libA.so will tell you this). When linking in >>> static libraries you're out of luck. >> >> With shared libraries, you need not and *should not* explicitly link >> recursive dependencies. If you have both static and shared libraries, >> the output of ldd could be used to find the recursive deps needed to >> link statically. This sucks and the logic to determine whether to put >> recursive deps in FOO_LIBRARIES ends up going in FindFoo.cmake which is >> insane. FWIW, pkg-config has Libs.private for this purpose. >> >> Finally, it would be nice to easily associate a symbol with a call to >> find_library. That is, suppose libA links to libB and libC, but libA >> never exposes libB or libC to users. To do the right thing (without >> abusing ldd), FindA.cmake needs to try linking with just -lA (which will >> work with all shared libs), then try with -lA -lB and -lA -lC before >> falling back to -lA -lB -lC (which is required when all libs are >> static). A better way which does not have exponential complexity would >> be to declare that the symbol "B_Foo" belongs with a libB and "C_Bar" >> belongs with a libC. So when linking with -lA fails, libB would be >> added exactly when B_Foo is undefined. >> >> Jed >> > _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake