[CMake] target_link_libraries between dll and static libs

Andreas Fredriksson deplinenoise at gmail.com
Mon Jun 9 13:45:18 EDT 2008


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)

add_library(dlib2 SHARED dlib2.c)
target_link_libraries(dlib2 dlib1)

Thanks,
Andreas


More information about the CMake mailing list