使用CMake选项命令而不是设置的优点? [英] Advantages of using CMake option command rather than set?

查看:218
本文介绍了使用CMake选项命令而不是设置的优点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为选项命令是多余的,因为它可以替换为 set 命令。使用选项命令可以获得什么好处?

I think the option command is redundant because it can be replaced by the set command. What are the benefits I could get when I use the option command?

推荐答案

p>在 选项中定义的变量 命令在CMake GUI中显示为布尔选项,或者使用 cmake -i 。但使用 set ,除非使用 CACHE 且类型不是 INTERNAL

A variable defined in an option command appears as a boolean choice in the CMake GUI or when running CMake interactively using cmake -i. This is not the case for a variable defined using set unless CACHE is used and the type is not INTERNAL.

此外, CMakeDependentOption 模块允许指定选项之间的依赖关系。

Also, the CMakeDependentOption module allows for specifying dependencies between options.

这篇关于使用CMake选项命令而不是设置的优点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆