As far as I know, CMake only comes with graphical cache editors. However, I need to edit some cache variables from a shell script. One way is to directly edit CMakeCache.txt
but this is not considered safe. Or is it? If not, what is the general practice of editing a cache variable from the command line?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You may call cmake
:
- with
-D
option(s) for set/modify cache variables, or - with
-U
option(s) for remove variables from the cache.
Running cmake
will cause the project to be reconfigured, but this should be an ultimate purpose of a any cache modification.