[CMake] Library dependency

Anders Backman andersb at cs.umu.se
Fri Dec 7 02:52:51 EST 2007


Hi all.

I have a question regarding library dependency.
Im using VC2005.


Assume the following:

I have a solution with a set of projects, three are libraries and one is an
application:

A.lib /A.dll

B.lib/B.dll : B depends on A.lib, so if I want to use B.lib somewhere,
A.libis also automatically added as a link dependency. Also
B.lib depends on X.lib which is a library external to the solution.
X.lib is also a X.lib/X.dll


C.lib, depends on B.lib, so in the list of libraries in Additional
Libraries, is now: A.lib, B.lib, X.lib


Application APP depends on C, so the list of libraries is then: A.lib ,
B.lib, X.lib, C.lib


Now if X.lib is a library with the implementation in a dynamic library, one
does not need to link C nor APP against X.lib because it is implicitly
already linked against B.lib


My question is now, is there a way to tell CMake to not include X.lib (which
is needed to build B.lib only) when using B.lib?
Otherwise the list of libraries in Additional LIbraries tends to be pretty
long...

It seems that Cmake always assumes that all libraries including their
dependencies should be used when building.
I realize that there is perhaps no way for CMake to automatically realize
whether a library should be included or not...
But is there a way around this?


-- 


________________________________________________________________
Anders Backman               Email:    andersb at cs.umu.se
HPC2N/VRlab                  Phone:    +46 (0)90-786 9936
Umea university              Cellular: +46 (0)70-392 64 67
S-901 87 UMEA SWEDEN         Fax:      +46 90-786 6126
                              http://www.cs.umu.se/~andersb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20071207/c63012eb/attachment.html


More information about the CMake mailing list