I think Eric's notion of creating a branch would be the way to go.  An
alternative (if you're on an OS supporting it) would be to create the
hierarchy of files as symlinks to the actual files.  You could surely
create a script to automate this.

Aaron Meadows


-----Original Message-----
From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf
Of Nicholas Yue
Sent: Monday, February 13, 2012 2:03 AM
To: cmake@cmake.org
Subject: Re: [CMake] External project source

On 13/02/12 6:47 PM, Eric Noulard wrote:
> 2012/2/13 Nicholas Yue<yue.nicho...@gmail.com>:
>> Hi,
>>
>>     There is an existing project I have access to that already have 
>> CMake configuration file but the way it is written requires alot of 
>> preprocessing steps (python, shell etc) before it is usable.
>>
>>     I wanted to investigate a cleaner (truer to CMake original design
>> purpose) usage of CMake,
>>
>>     So, I have an  original-project directory which contains both the

>> source and the CMakeLists.txt in a nested directory structure.
>>
>>     I want to create my own CMake hierarchy (structure the same way) 
>> but reference the source code in the original-project directory
location.
>>
>>     How do I tell CMake to refer to source code at some other top 
>> level directory as a starting point.
>>
>>     Is there such a concept in CMake ?
> I am not sure to fully understand you request but in a CMakeLists.txt 
> you can perfectly refer to source located outside the directory the 
> CMakeLists.txt is in, you can use either relative or absolute path and

> do something like:
>
> add_executable(NiceTarget ../../relpath/to/source.c
> ${CMAKE_SOURCE_DIR}/abspath/to/another.c)
Yes, I know I can do that. I am hoping to avoid maintaining a hierarchy
of such modification.

There are 42 CMakeLists.txt files each with multiple libraries, test and
such.

I was hoping there is a way to (assuming I maintain the same hierarchy)
tell CMake to start looking for source from some other top level
directory 'once' and it will be able to find the source in the 'other' 
location that is different to my 'cleaned-up' version of CMakeLists.txt

Regards

> this is usually a bad idea but this should work.
>
> Now that said if you do that for compatibility purpose in order to 
> maintain the legacy build before doing the switch to "genuine" CMake 
> build then may be using a VCS like git would be a better way to go.
I have this as a fall back.

Best regards

--

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

This email was sent to you by Thomson Reuters, the global news and information 
company. Any views expressed in this message are those of the individual 
sender, except where the sender specifically states them to be the views of 
Thomson Reuters.
--

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