[CMake] Link something to future installed library

David Demelier demelier.david at gmail.com
Sun Mar 10 12:08:35 EDT 2013


Hello,

I'm trying to make a common core library that will help creating modules, my 
modules will link against it but this will not work as these modules will link 
against the library in the binary build directory.

My CMakeLists.txt is quite complexe with a lot of subdirectories so I will 
just reduce to a small example that explain my problem :

# My common library
file(GLOB COMMON "core/*")
add_library(core SHARED ${COMMON})
install(TARGETS core DESTINATION "myapp/lib")

# Now create some modules
add_library(mod1 MODULE mod.cpp)
install(TARGETS mod1 DESTIONATION "myapp/lib/modules")

And then I would like mod1 to be linked to the future installed core library.

I really want my common library to be a shared library, then everyone that 
would like to create new modules can do it independently of this project.

Is there any workaround or possibilities to solve my issue?

Cheers,

-- 
David Demelier


More information about the CMake mailing list