[CMake] Simple (?) lib linking question

William A. Hoffman billlist at nycap.rr.com
Mon Aug 7 12:04:06 EDT 2006


At 11:52 AM 8/7/2006, Anders Sundman wrote:


>What is the rationale for this design desision? It seems to me that this
>feature introduces an unnecessary dependency? It's not realy a big issue
>for me, but I'm curious.

Most of the time it is a necessary dependency.  Especially in the case
of linking static.   For example:

libA 
libB  uses stuff from libA
exe uses libB, and will need libA to link

In the cmakelist files for exe, you just have to
do target_link_libraries(exe libB)  and you automatically get libA.

The case where libB does not require libA only happens with shared
builds, and is much less common.  There is some talk about having
the concept of public and private libraries that will be added in
the future to address this issue.

-Bill



More information about the CMake mailing list