[CMake] target_link_libraries between dll and static libs

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jun 9 14:48:01 EDT 2008


On Monday 09 June 2008, Andreas Fredriksson wrote:
> Hi,
> I'm wondering why the below CMake snippet causes dlib2 to link with
> slib. Does it really make sense to propagate static dependencies
> upward from dynamic libraries or am I missing something? Is there a
> way to disable it? :)
>
> add_library(slib STATIC lib1.c)
>
> add_library(dlib1 SHARED dlib1.c)
> target_link_libraries(dlib1 slib)

Which behaviour do you expect here ?
Not everything from slib will be included in dlib1.

There is an entry in the FAQ:
http://www.cmake.org/Wiki/CMake_FAQ#Why_are_libraries_linked_to_my_shared_library_included_when_something_links_to_it.3F

Alex


More information about the CMake mailing list