[CMake] intercomponent link dependencies?

Jed Brown jed at 59A2.org
Wed Jan 13 08:07:17 EST 2010


On Wed, 13 Jan 2010 13:51:57 +0100, Nico Schlömer <nico.schloemer at gmail.com> wrote:
> > Overlinking is actually only an issue for dynamic libraries. So as
> > long as you're absolutely sure that you only have static libraries,
> > you're fine.
> 
> Oh, I was thinking it is *unclean* to have a link line like

Overlinking is orthogonal to this.  Suppose we have libA depending on
libB, but consumers of libA never call into libB directly.  With shared
libraries, libA.so will reference libB.so and the user only needs to
link with -lA.  Overlinking means using -lA -lB which means that e.g. an
ABI change in libB requires not just rebuilding libA, but also the
client application.  With static libs, you have no choice.

> -llibrarya /usr/local/local/liblapack.a --llibraryb
> /usr/local/local/liblapack.a     (1)

[...]

> So, yeap, it works, but I expected CMake to clean up after me
> dependency-wise -- instead of (1), this
> 
> -llibrarya --llibraryb /usr/local/local/liblapack.a     (1')

This cannot be done automatically because some people end up with
dependency loops and CMake does not know the dependency graph.

Jed


More information about the CMake mailing list