[CMake] Help re-generating CMakeCache

Alexander Neundorf a.neundorf-work at gmx.net
Thu Mar 25 14:07:08 EDT 2010


On Thursday 25 March 2010, Ashwin Chandra wrote:
> I am using a Linux makefile to pass an environment variable into cmake.
> For example, I call
>
>
>
> "MYVAR=test make -f Linux.mak debug-build"
>
>
>
> Then inside my Linux.mak I issue a "cmake ... -DMYCMAKEVAR=$(MYVAR)".
>
>
>
> This defintion works fine the first time I do a build and cmake
> generates all the cmakecache and makefiles.
>
>
>
> But after I build once, let's say I decide to change MYVAR to:
>
>
>
> "MYVAR=test1234 make -f Linux.mak debug-build"
>
>
>
> Then CMake doesn't seem to update the CMakeCache with this new value of
> MYCMAKEVAR.
>
> Something about building a second time when the cache has already been
> created is causing this to fail.

Not sure.
If I do 
$ cmake -DFOO=foo .
then FOO is set to foo in CMakeCache.txt.
If I then do 
$ cmake -DFOO=bar .
then FOO is set to bar in CMakeCache.txt.

Does this work for you ?

Alex


More information about the CMake mailing list