如何在我的CMake脚本中添加配置变量? [英] How do I add a configuration variable to my CMake script?

查看:165
本文介绍了如何在我的CMake脚本中添加配置变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一个用户必须在cmake-gui中单击配置后设置的变量。有办法吗?

I'd like to add a variable that the user must set after clicking "Configure" in cmake-gui. Is there a way to do this?

推荐答案

使用set命令,指定CACHE参数,例如

Using the set command, specify CACHE parameters, e.g.

set(NAME_INCLUDE "default value" CACHE FILEPATH "description")
set(NAME_LIB "default value" CACHE FILEPATH "description")

在GUI中,CMake将所有具有相同前缀的变量分组。

In the GUI CMake will group all variables with the same prefix.

有关设置的信息,请参阅CMake文档。

See the CMake documentation for set.

这篇关于如何在我的CMake脚本中添加配置变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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