来自subdirs pro文件的.pro文件的变量 [英] Variables that persist across .pro files from a subdirs pro file

查看:323
本文介绍了来自subdirs pro文件的.pro文件的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我有一个.pro文件,如下所示:

I've got a .pro file that looks like:

TEMPLATE = subdirs
SUBDIRS = foo bar

我想设置一个变量,或定义,或者我的子文件.pro文件中的东西,可以在foo和bar .pro文件中读取。

I want to set a variable, or define, or something in my subdirs .pro file that can be read in both the foo and bar .pro files.

我试图设置环境变量:

export TEST=something

但这不起作用,消息($$(TEST))总是不显示任何内容(如TEST未设置)。

but that does not work, message($$(TEST)) always shows nothing (like TEST is unset).

推荐答案

另一个选项是将公共变量放在名为.qmake.cache的文件中,该文件存储在项目的根目录中。这样,您不需要在subdir项目中包含任何.pri文件。

Another option is to place the common variables in a file called ".qmake.cache" stored in the root dir of the project. This way you don't need to include any .pri files in the subdir projects.

这篇关于来自subdirs pro文件的.pro文件的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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