[CMake] Shared Library Dependencies with Visual Studio 2005 or 2003 Generator

Brad King brad.king at kitware.com
Thu Aug 17 14:11:46 EDT 2006


Ryan Connelly wrote:
> I have a question about TARGET_LINK_LIBRARY(). I noticed that when I add
> linked libraries to a shared library and then link that library with
> another shared library, the last library linked includes ALL previously
> liked libraries when linking.
> 
> In other words:
> 
> We have 3 shared (dll) libraries: A, B, C. Library B depends on and
> links with shared library A. Library C depends on B (and not A).
> However, the link line for C includes A. Shouldn't it just include B. If
> I remove the A library from C's link line, I am still able to link the
> library. It seems that Cmake is adding these extra libraries unnecessarily.
> 
> I am using Visual Studio 2005.
> 

I've just added a FAQ entry for this:

http://www.cmake.org/Wiki/CMake_FAQ#Why_are_libraries_linked_to_my_shared_library_included_when_something_links_to_it.3F

-Brad


More information about the CMake mailing list