David Demelier wrote: > 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/*")
GLOB will generate a list of all files that match the globbing expressions and
store it into the variable. Globbing expressions are similar to regular
expressions, but much simpler. If RELATIVE flag is specified for an
expression, the results will be returned as a relative path to the given path.
(We do not recommend using GLOB to collect a list of source files from your
source tree. If no CMakeLists.txt file changes when a source is added or
removed then the generated build system cannot know when to ask CMake to
regenerate.)
> 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?
When you install the modules, they will be linked against the install
location. As long as they are in the build tree they will use the build tree
location. So I guess there is no issue.
Eike
--
signature.asc
Description: This is a digitally signed message part.
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
