有没有从命令行编辑缓存变量的安全方法? [英] Is there a safe way to edit a cache variable from the command line?
本文介绍了有没有从命令行编辑缓存变量的安全方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
据我所知,CMake仅随附图形缓存编辑器。但是,我需要从shell脚本中编辑一些缓存变量。一种方法是直接编辑 CMakeCache.txt
,但这并不安全。还是?如果没有,从命令行编辑缓存变量的一般做法是什么?
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?
推荐答案
您可以调用 cmake
:
- ,带有
-D
选项(s)用于设置/修改缓存变量,或 - 带有
-U
选项,用于从缓存中删除变量。
- with
-D
option(s) for set/modify cache variables, or - with
-U
option(s) for remove variables from the cache.
运行 cmake
将导致重新配置项目,但这应该是修改缓存的最终目的。
Running cmake
will cause the project to be reconfigured, but this should be an ultimate purpose of any cache modification.
这篇关于有没有从命令行编辑缓存变量的安全方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文