[CMake] third party library dependencies

Jed Brown jed at 59a2.org
Sat Dec 19 05:28:12 EST 2009


On Fri, 18 Dec 2009 14:45:51 -0500, Roman Shtylman <shtylman at 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.

Yes, but ldd will only help if your system also has shared versions of
these libraries.  If you only have statically linked versions, then the
presence of unresolved symbols are the only indication that a recursive
dependency is missing (in the absence of pkgconfig or other external
indicator).

> 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.

Yes, with static linking, all recursive deps should go into a
FOO_LIBRARIES.  Yes, it's a PITA to work out what the recursive deps
are, and CMake currently doesn't help.  Also, static linking should not
be a global choice made in some Find*.cmake.  This appears to be a major
flaw, the vast majority of Find* modules distributed with CMake are
broken for static linking.  I've pointed it out before and the response
seems to be that either you shouldn't want to do such a thing or that
Find* authors should write clairvoyant code.

Jed


More information about the CMake mailing list