[CMake] aggregating projects

Bill O'Hara billtohara at gmail.com
Tue Feb 3 19:15:11 EST 2009


Can anyone comment on the most common way to aggregate together multiple
projects built using cmake into some larger structure?

Lets say I have 3 tools, foo, bar and baz.

foo is standalone and has a toplevel CMakeLists.txt with a PROJECT(FOO)

bar is standalone and has a toplevel CMakeLists.txt with a PROJECT(BAR)

baz requires foo to be built (there are many other uses of foo as well) and
used during build of baz (ie. generating some custom inputs).

And then we want to build a top level system project that causes all the
other tools to be built and packaged together. From the FAQ I can see how to
use custom commands to use a generated executable and process files during
the build of a project, with correct dependency tracking.

Any pointers on how to deal with aggregating multiple projects like this? A
naive

add_subdirectory(/home/bill/bar ${PROJECT_BINARY_DIR}/bar)

runs into fairly sensible problems due to add_subdirectory commands within
the subsidiary project CMakeLists...

CMake Error at /home/bill//bar/CMakeLists.txt:18 (ADD_SUBDIRECTORY):
  add_subdirectory given source "/home/bill/baz/impl" which is not an
  existing directory.

?

thanks
b.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090203/7c31973f/attachment.htm>


More information about the CMake mailing list