[CMake] Project dependencies

Benjamin Eikel cmake at eikel.org
Wed Apr 14 05:49:01 EDT 2010


Hello,

we are using CMake to build different binaries which depend on some libraries, 
that we develop ourselves. At the moment we export the settings from the build 
directories of the libraries using export(... lib-build.cmake ...). The 
CMakeLists.txt of a binary uses an own CMake module using find_package(), in 
which we check for the "lib-build.cmake" file. If it exists, it is included 
and the library variable is set to the imported TARGET. Otherwise the library 
is searched with find_library and used as dependency.
The build works without problems if the libraries are built first and the 
binary afterwards. I am wondering if it is possible to trigger an automatic 
build of the libraries when building the binary. For example the libraries 
should be built if they have not been built yet or there have been changes to 
the source files.
I think, if the library projects were integrated into the build using 
add_subdirectory(), this will work.
Because we additionally let CMake generate Eclipse projects, it would be nice 
if the library projects which are exported and imported by the binary project, 
will be marked as references of the binary project (Project -> Properties -> 
Project References).
For the record: We are using CMake in version 1.8.1 under GNU/Linux and 
Windows.

Kind regards,
Benjamin


More information about the CMake mailing list