[CMake] question about combining cmake builds

Bill Hoffman bill.hoffman at kitware.com
Thu Nov 3 14:23:07 EDT 2011


On 11/3/2011 1:19 PM, Paul Whelan wrote:
> Hi guys,
>
> I have a possibly naive question about cmake. I've got three
> applications that build with cmake. Normally they build and run
> independently. However, for a particular release I have to combine them
> in a source distribution. I wanted to create a cmake script in a parent
> directory containing all three source trees and give the end-user one
> simple cmake command to run. Sounds simple enough.
>
> The problem I run into in doing that is that with the CMakeList.txt
> files of each source tree, there are some directory references relative
> to ${CMAKE_BINARY_DIR} and ${CMAKE_SOURCE_DIR}. So, when cmake is run
> from a higher level directory, these directory macros are one level up
> from where they normally are and it throws off the build.
>
> The question I have is "Is there a way to use cmake in a parent
> directory to recursively invoke cmake on the CMakeList.txt files in each
> of these source trees such that the source and binary root directories
> are set to what they are normally expected to be?
>

You should look at the ExternalProject module.

-Bill



More information about the CMake mailing list