[CMake] load CMakeCache.txt settings into new build directory?

Michael Jackson mike.jackson at bluequartz.net
Mon Apr 6 22:33:51 EDT 2009


I _think_ the way to do this in your script would be to use either one  
of:

   -C <initial-cache>          = Pre-load a script to populate the  
cache.
   -D <var>:<type>=<value>     = Create a cmake cache entry.

In the -C variant you would have a *.cmake file that has all the  
necessary entries in it that you want to set, or want the user to  
automatically have. I think you just use the normal cmake syntax:

set(CMAKE_BUILD_TYPE "Debug")

In the -D variant you would need to pass in all the settings that you  
need on the command line:

cmake -D CMAKE_BUILD_TYPE:STRING=Debug ../SourceDirectory


Your choice.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Apr 6, 2009, at 5:38 PM, Ian Monroe wrote:

> I want to write a script that, in response to 'make distcheck', git
> clones the source repo into a new directory under the build directory,
> builds it and runs make test.
>
> The issue is that if the user had to tweak their cmake settings to get
> it to build thats not going to work, since the new build directory
> would need to be similarly tweaked.
>
> Is there a solution to this?
>
> Ian
> _______________________________________________
> 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



More information about the CMake mailing list