[CMake] Is it possible to call or include CMakeCache from another CMakeCache?

Kevyn-Alexandre Paré kapare at rogue-research.com
Tue Jul 19 11:50:09 EDT 2011


Hi David,

thx for the reply see below.

On 2011-07-19, at 6:41 AM, David Cole wrote:

> On Mon, Jul 18, 2011 at 3:51 PM, Kevyn-Alexandre Paré
> <kapare at rogue-research.com> wrote:
>> Hi,
>> 
>> Is it possible to call or include CMakeCache from another CMakeCache?
>> 
>> I want to replace my 2 CMakeCache to one.
>> 
>> ex:
>> 
>> cmake -C Config-Generic.txt :qConfig-Project.txt ../
>> 
>> Any idea if it's possible to include the Config-Generic.txt inside the Config-Project.txt?
>> 
>> Best Regards,
>> 
>> Kevyn-Alexandre Paré
>> 
>> 
>> _______________________________________________
>> 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
>> 
> 
> Ii don't think this really sounds like a wise idea...

That's the reason why I post the question. But why it's not, this is why I'm asking.

> 
> What is it you're trying to accomplish?

Sorry if I didn't gives enough explanation. I'm trying to remove the cut & paste on each project for:

CMAKE_BACKWARDS_COMPATIBILITY
CMAKE_C_COMPILER
CMAKE_CXX_COMPILER
CMAKE_SYSTEM_PROCESSOR
CMAKE_BUILD_TYPE
and a lot of other flag 

by putting all of these in a generic CMakeCache file. So I could reuse that generic config file for other project.


> If you have two CMakeCache
> files, then you have two separate projects, and you've run CMake on
> each of them to get the two CMakeCache files.

No this isn't what we are trying to accomplish. It's possible to use cmake with multiple cache file:

cmake -C Cache1.txt -C Cache2.txt <path to cmakelist.txt>

> So why do you want to
> combine them into one?

Since I'm having a generic cache file that contain the generic project detail. I was interested from the cache specific to INCLUDE that generic cache file like a simple header file (like in C).

> If you only want one project, then why not
> simply merge the two CMakeLists files together into one project?

Because at the end since we are having multiple project we were hoping to reuse and not cut and paste.

> 
> Let us know what you're trying to achieve, maybe there's a better
> supported way to do it.

I hope with these explanation it's clearer !?

> Combining multiple CMakeCache files is not
> something that the CMake dev team expects you to do...

Ok so why supporting multiple cache parameters?


> Trying to do so
> will very likely lead to weird, inexplicable issues.....

Right now I don't have strange behaviour  and everything is working fine. But if in the future that option will not be supported. I would really like to be advise on what is the best way to do this.

Best Regards,

--
Kevyn-Alexandre Paré
Rogue Research


> 
> 
> HTH,
> David



More information about the CMake mailing list