[CMake] question about combining cmake builds

Paul Whelan pwhelan at aer.com
Thu Nov 3 13:19:53 EDT 2011


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?

Thanks,
Paul


More information about the CMake mailing list