Qt Creator 项目构建变量从何而来? [英] Where Qt Creator project build variables come from?
问题描述
On Qt Creator Tools
>Options
>Build &运行
>Default Build Properties
默认构建目录
具有根据变量定义的值
On Qt Creator Tools
>Options
>Build & Run
>Default Build Properties
the Default build directory
has the value defined in terms of variables
../%{JS: Util.asciify("_build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}")}
导致类似
_build-Project1-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug
这些变量(CurrentProject:Name、CurrentKit:FileSystemName 和 CurrentBuild:Name)从何而来?
From where those variables (CurrentProject:Name, CurrentKit:FileSystemName and CurrentBuild:Name) come from?
我想生成一些不同的(更短的),也许像
I would like to generate something different (shorter), perhaps like
_x86-debug
或 _x86d
或 _x64-debug
或 _x64d
我应该寻找哪些变量?
推荐答案
如果您单击重置"按钮附近和插入变量"工具提示上方的 A->B 按钮,您将看到一个列表Qt Creator 中可用的全局变量
If you click on the A->B button near the Reset button and above the tooltip that says "Insert Variable", you'll see a list of the global variables available in Qt Creator
这是同一个列表,但更容易阅读:https://www.programmersought.com/article/73762199051/
This is the same list, but easier to read: https://www.programmersought.com/article/73762199051/
这是内部变量的官方文档:https://doc.qt.io/qtcreator/creator-project-settings-environment.html#using-qt-creator-variables
And this is the official docs for internal variables: https://doc.qt.io/qtcreator/creator-project-settings-environment.html#using-qt-creator-variables
你可以这样做:../%{JS: Util.asciify("_x64-%{ActiveProjectBuildConfig:Type}")}
或者您可以为您的架构设置一个环境变量,无论是 x86 还是 x64,然后执行:../%{JS: Util.asciify("_%{Env:ARCH}-%{ActiveProjectBuildConfig:Type}")}
Or you could set an environment variable with your architecture, be it x86 or x64, and do:
../%{JS: Util.asciify("_%{Env:ARCH}-%{ActiveProjectBuildConfig:Type}")}
JS 是一个特殊的变量,支持表达式求值.
这是官方文档:
https://doc.qt.io/qtcreator/creator-project-wizards.html#using-variables-in-wizards
这个答案提供了 Qt Creator 公开的函数列表:https://stackoverflow.com/a/43763489/10996546
JS is a special variable that enables expression evaluation.
This are the official docs:
https://doc.qt.io/qtcreator/creator-project-wizards.html#using-variables-in-wizards
This answer provides a list of the functions exposed by Qt Creator:
https://stackoverflow.com/a/43763489/10996546
这篇关于Qt Creator 项目构建变量从何而来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!