On 11/04/2011 06:19 AM, Michael Wild wrote:
> On 11/03/2011 07:23 PM, Bill Hoffman wrote:
>> 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
> 
> Alternatively, if that is your only problem, modify the individual
> projects to use the PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR variables
> instead.
> 
> Michael

Absolutely. IMO, CMAKE_{SOURCE,BINARY}_DIR should definitely *not* be
used if PROJECT_{SOURCE,BINARY}_DIR is actually meant, as this makes
the project unnecessarily less self-contained, particularly w.r.t.
its integration in a superordinate project.

Regards,

Michael
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to