Reputation:
I know that in order to set a variable, we do -DVARIABLE=VALUE
, but what if I need to unset it?
I tried -DVARIABLE=FALSE
but it didn't work, the compiler complains about what does FALSE
means
Upvotes: 10
Views: 8189
Reputation: 7873
The magic flag is -U
. Trimmed output:
$ grep DOCS CMakeCache.txt
HOUSEGUEST_BUILD_DOCS:BOOL=OFF
$ cmake -UHOUSEGUEST_BUILD_DOCS .
-- Configuring done
-- Generating done
-- Build files have been written to: /my/build/folder
$ !grep
grep DOCS CMakeCache.txt
HOUSEGUEST_BUILD_DOCS:BOOL=ON
From cmake --help
:
-U <globbing_expr> = Remove matching entries from CMake cache.
Upvotes: 13