[CMake] Using a toplevel CMakeList.txt to build all sub projects at once.

PCMan pcman.tw at gmail.com
Thu Feb 6 01:14:38 EST 2014


Hello,
I'm PCMan, one of the developers of LXDE desktop (now LxQt after
merged with Razor-qt project).
http://lxde.org/ and http://razor-qt.org/

We're migrating from gtk+ to Qt and autotools to CMake and encountered
some issues.
There are many small modules or components in our project.
Each of them has their own CMakeLists.txt and can be built separately.
However, it's hard to build so many projects manually.
So we'd like to create a toplevel CMakeLists.txt to build them all at once.
However, the small projects depend on each other.
For example, our project layout look like this:

libqtxdg - a base lib required by others
liblxqt - a library depends on libqtxdg
lxqt-config - a tool depends on liblxqt and libqtxdg.

To build lxqt-config, liblxqt and libqtxdg need to be "installed" first.
So simply adding them using add_subdirectoyy() won't work.
When configuring lxqt-config, liblxqt needs to be installed first.
To configure and compile liblxqt, cmake modules and headers from
libqtxdg are required so libqtxdg needs to be installed first.

Is it possible to use CMake to build them all at once since one
component requires that the other is installed first.

Even worse, two of our components are still automake-based.
The cmake ExternalProject_Add() command did not solve the problem that
some of them needs to be "installed" first before others can be
compiled.

I tried to google and read the existing docs but remain clueless.
We're stuck! Any help is really appreciated.
Thank you very much!


More information about the CMake mailing list