[CMake] aggregating projects

Clinton Stimpson clinton at elemtech.com
Tue Feb 3 19:26:10 EST 2009


I do a simple
==CMakeLists.txt ==
add_subdirectory(foo)
add_subdirectory(bar)
add_subdirectory(baz)
==end==

If those projects don't like that, I fix them.

Clint

Bill O'Hara wrote:
> 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.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list