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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.