[CMake] Manner to manage the dependencies

Weiyu Yi inweiyu at googlemail.com
Mon Oct 25 09:13:09 EDT 2010


Hi,

This is Weiyu, a student from University of Germany.  I have used
CMake as the build system instead of autotool already for some
projects. but I am still not sure about the way how the libraries
dependencies should be handled,  is there any suggestion from CMAKE
group that how the dependencies within the project are dealed with?

I have roughly read the cmake files from KDE 4.0+ and OpenSG 2.0 beta.
 The build system from OpenSG 2.0 seems too complicated for my code
where there are only less than 10 parts(directories) of source codes.
OpenSG 2.0 saves the dependencies and the information for building
into txt files in order to manage great mount of dependencies

While the cmake files from KDE 4.0 seems too simple, or?

The way I use cmake now is like that :

-----------------------------------------------------------------------------------

1) write some macro and functions in a separate file, and

2) for each separate part(directoriy) of my codes with sub-project
name "XXX", I make a FindXXX.cmake file, which will be called to
handle the dependency

3) CMakeLists.txt in each directory, like

ADD_INTERNAL_DEPENDENCY( XXX )
SETUP_LIBRARY_BUILD()

-----------------------------------------------------------------------------------

But the way how i use the mechanism of FindXXX.cmake and FIND_PACKAGE(
XXX ) is not the suggested way from the CMake group

because the library hasn't been created while cmake is processing. so
FIND_LIBRARY() doesn't work, I use find_path() or direct assignment
instead

Is it a good way how to deal with dependencies with CMAKE?

or could you give me some suggestion?

Thanks very much

Weiyu
Oct 25, 2010


More information about the CMake mailing list