[CMake] Problem while setting variables in CMakeCache

Michael Hertling mhertling at online.de
Mon Sep 6 13:30:49 EDT 2010


On 09/06/2010 06:33 PM, Stefan Köhnen wrote:
> Hello,
> 
> I am trying to set a variable that appears in CMakeCache. I made this
> small example to show what I am trying to do.
> 
> CMakeLists.txt:
> PROJECT(CMakeTest)
> 
> SET(VAR_FOR_TEST "firstValue" CACHE STRING "Just for testing")
> 
> set(VAR_FOR_TEST "secondValue")
> 
> MESSAGE (${VAR_FOR_TEST})
> 
> 
> When I run cmake from the build-folder I get the message
> "secondValue", but when I look in the CMakeCache.txt-file I see this:
> 
> //Just for testing
> VAR_FOR_TEST:STRING=firstValue
> 
> Why is VAR_FOR_TEST set to firstValue, there is probably something I
> missed in my CMakeLists.txt but I found no example for this kind of
> problem on the Internet.
> 
> My CMake version is 2.6-patch 3, but I think the problem is my code not CMake.

See <http://www.cmake.org/pipermail/cmake/2010-July/037939.html> et seq.

Regards,

Michael


More information about the CMake mailing list