我知道为了设置变量,我们会-DVARIABLE=VALUE
,但是如果我需要取消它会怎么样?
我尝试了-DVARIABLE=FALSE
但是它没有用,编译器抱怨FALSE
意味着什么
答案 0 :(得分:4)
神奇的旗帜是-U
。修剪输出:
$ 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
来自cmake --help
:
-U <globbing_expr> = Remove matching entries from CMake cache.