[CMake] Removing from Cache doesn't work in Windows?

Michael Karcher cmake at mkarcher.dialup.fu-berlin.de
Mon Jun 15 02:58:21 EDT 2009


Hello everyone.

I have a simple test CMakeLists.txt like this:

message("Old value " ${MY_VAR})
set(MY_VAR "default value" CACHE STRING "test var")
message("New value " ${MY_VAR})

On Debian Linux, I get expected behaviour:

karcher at hermes2:~/test$ cmake .
[...]
Old value 
New value default value
[...]
karcher at hermes2:~/test$ cmake .
Old value default value
New value default value
[...]
karcher at hermes2:~/test$ cmake -DMY_VAR=different .
Old value different
New value different
[...]
karcher at hermes2:~/test$ cmake -UMY_VAR .
Old value 
New value default value
[...]
karcher at hermes2:~/test$ cmake --version
cmake version 2.6-patch 4

So, first I run cmake without any CMakeCache.txt, then I run it with the
default value in the cache, then I force a different value via command
line and finally I go back to default. Doing the same in Windows fails:

Z:\test>cmake -G "MinGW Makefiles" .
[...]
Old value
New value default value
[...]
Z:\test>cmake -G "MinGW Makefiles" .
Old value default value
New value default value
[...]
Z:\test>cmake -DMY_VAR=different -G "MinGW Makefiles" .
Old value different
New value different
[...]
Z:\WSD4HA~2\MPL5DT~G\cmaketest>cmake -UMY_VAR -G "MinGW Makefiles" .
Old value different
New value different
[...]
Z:\WSD4HA~2\MPL5DT~G\cmaketest>cmake --version
cmake version 2.6-patch 4

It seems like the "-U" option gets ignored in this case. Am I doing
something wrong or is cmake on Windows (installed from the official
binary package) broken?

Regards,
  Michael Karcher



More information about the CMake mailing list