[CMake] target_link_libraries of MODULE
Paul Chavent
paul.chavent at fnac.net
Sat Jan 12 14:34:53 EST 2013
Hi.
I'm working on a project basically compound of :
- a core library that can be static or dynamic
add_library(Foo-lib ${FOO_LIB_SOURCES})
- an executable that rely on the main library :
add_executable(Foo-bin ${FOO_BIN_SOURCES})
target_link_libraries(Foo-bin Foo-lib)
- a "dlopen"able plugin that need some functions of the Foo library :
add_library(Foo-plugin MODULE ${FOO_PLUGIN_SOURCES})
target_link_libraries(Foo-plugin Foo-lib)
I don't need the last line under linux : i usually don't link Foo-plugin against Foo-lib.
And that's good because if i choose to build a static Foo-lib, i don't want in Foo-plugin all symbols that will be already present in Foo-bin.
Under Windows (MinGW) or MacOSX, without this last line i have unresolved symbols when i compile Foo-plugin. So i let it be.
The problem comes when i try to compile static Foo-lib. I have segfault at the Foo-plugin load time, probably because of some static class/variables initializations.
What is the good practice please ? Isn't there any option to tell to ignore unresolved symbols for MODULE ? They will be resolved at load time !
Regards.
Paul.
P.S i use a 2.8.10 version of cmake.
More information about the CMake
mailing list