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

Ian Monroe ian at monroe.nu
Tue Apr 7 09:50:51 EDT 2009


On Mon, Apr 6, 2009 at 10:33 PM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
> 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

But I don't really know what the users needs. Like for me I don't need
to pass any options. Others might have had to tweak things to
recognize a given library.

I wonder if I could just run a find&replace regex on the
CMakeCache.txt to change the build directory.

Ian


More information about the CMake mailing list