导出cmake-gui选项 [英] Exporting cmake-gui options
问题描述
我有一个带有许多不同配置选项的库.我们通常使用 cmake-gui
并选中几个复选框来配置构建.
I have a library with a bunch of different configuration options. We usually configure the build with cmake-gui
and ticking a few checkboxes.
我想仅使用 cmake
将其自动化为 .sh
脚本.
I want to automate this into a .sh
script using just cmake
.
例如
在GUI中->选择一堆不同的选项
等效的cmake命令-> cmake -D CMAKE_XXX = X -D CMAKE_XXY = XXY [这里有很多选项] ..
如何找到与我从GUI中选择 的任意配置相同的 cmake
命令行命令?
How can I find the "equivalent" cmake
command-line command to any arbitrary configuration I choose from the GUI?
推荐答案
以前的文档是含糊不清的,因此请务必始终检查最新版本.
The equivalent cmake command to cache a variable is explained here (-D
option). Note that previous documentation was ambiguous, so take care of always checking the latest one.
基本上:
-D<var>:<type>=<value>
还必须指定类型,以与通过cmake-gui过程相同的方式来缓存变量.请注意,只有在第一次时才需要定义变量:如果不再指定,则将使用缓存的值.
You have to specify also the type to have the variable cached in the same way as through your cmake-gui procedure. Note that variable definition is necessary only the first time: if not specified anymore, the cached value will be used.
这篇关于导出cmake-gui选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!