I had a variable entered in the cache from the command line, without giving it a type. And the variable was not declared as cache variable in my CMakeLists.txt. In the CMakeCache.txt it looked like:
FOO_UNTYPED:UNINITIALIZED=999
I have noticed that this entry in the cache:
- it remains if I run
cmake build_dir, orcmake -DNEW_VARIABLE=123 build_dir - it remains if I run
ccmake build_diradd press Configure + Generate - it disappears if I run
cmake-gui build_dirand press Configure + Generate
I’m aware that I can avoid this problem by either:
- set the variable as a cache variable with a type in CMakeLists.txt
- supply a type on the command line in the
-Doption
But I was surprised by the way cmake-gui differed from the other situations. Is this intentional?