When building Qt you can use CMake variables to control the build result.
| 變量 | 描述 |
|---|---|
| QT_HOST_PATH | Location of the host Qt installation from which host tools may be used during another Qt build, either a regular one or a cross-compiling one. |
QT_FORCE_BUILD_TOOLS
|
Forces building tools even if host tools have already been found. Useful when cross-compiling Qt to ensure the SDK has cross-built tools. |
QT_FORCE_FIND_TOOLS
|
Uses Qt tools from the pre-built Qt in
QT_HOST_PATH
when you do not cross-compile. The variable only takes effect if
QT_FORCE_BUILD_TOOLS
被設為
ON
. Otherwise
QT_FORCE_FIND_TOOLS
does not affect the default behavior.
|
Qt 模塊的加載采用
find_package
設置各種變量。
注意: 您很少需要直接訪問這些變量。像鏈接到模塊的常見任務,應透過每個模塊定義的庫目標來完成。
例如,
find_package(Qt6 COMPONENTS Widgets)
,當成功時,使以下變量變得可用:
| 變量 | 描述 |
|---|---|
Qt6Widgets_COMPILE_DEFINITIONS
|
要使用的編譯定義列錶,當針對庫構建時。 |
Qt6Widgets_DEFINITIONS
|
要使用的定義列錶,當針對庫構建時。 |
Qt6Widgets_EXECUTABLE_COMPILE_FLAGS
|
要使用的標誌字符串,當針對庫構建可執行文件時。 |
Qt6Widgets_FOUND
|
描述是否成功找到模塊的布爾。 |
Qt6Widgets_INCLUDE_DIRS
|
要使用的 include (包括) 目錄列錶,當針對庫構建時。 |
Qt6Widgets_LIBRARIES
|
模塊導入目標的名稱:
Qt6::Widgets
|
Qt6Widgets_PRIVATE_INCLUDE_DIRS
|
要使用的私有 include (包括) 目錄列錶,當針對庫構建並使用私有 Qt API 時。 |
Qt6Widgets_VERSION
|
包含模塊版本的字符串。 |
對於找到的所有包采用
find_package
,這些變量的等價物是可用的;它們區分大小寫。
此外,還有一些變量與特定包無關,但與 Qt 安裝本身相關。
| 變量 | 描述 |
|---|---|
|
|
控製 Qt 版本的整數,
qt_
命令被轉發給 Qt 5 和 Qt 6 混閤工程。需要將其設為
5
or
6
先前分彆
find_package()
調用。
若設為
若未設置,首
|
QT_LIBINFIX
|
保持庫名稱所用中綴的字符串,當有配置 Qt 采用
-libinfix
.
|
|
|
隱藏命令開頭采用
qt_
,隻剩餘版本號開頭采用
qt6_
.
|
|
|
隱藏導入目標開頭采用
Qt::
。相反,需要使用的目標開頭采用
Qt6::
.
|
QT_VISIBILITY_AVAILABLE
|
在 Unix,布爾描述 Qt 庫和插件是否被編譯采用
-fvisibility=hidden
。這意味著僅選中符號被導齣。
|
這些變量能影響由 QT 提供的 CMake 命令。它們可以由工程、工具鏈文件或其它第 3 方包設置。
| 主機係統的特定 Android 體係結構 | |
| Android SDK 的位置 | |
| List of ABIs that the project packages are built for | |
| 傳遞給 Android 應用程序的自變量列錶 | |
| Enables building multi-ABI packages using the autodetected Qt for Android SDK list | |
| Forces or disables release package signing regardless of the build type | |
| Enables the generation of QtQuickViewContent-based classes | |
| Allows to share CMake variables in multi-ABI builds | |
| Signs the .aab package with the specified keystore, alias, and store password | |
| Signs the package with the specified keystore, alias, and store password | |
| Prefix-relative subdirectory for deploying runtime binaries on some target platforms | |
| Directories that are excluded from runtime dependencies search | |
| Prefix-relative subdirectory for deploying program executables on some target platforms | |
| Prefix-relative subdirectory for deploying libraries on some target platforms | |
| Prefix-relative subdirectory for deploying Qt plugins on some target platforms | |
| 用於部署的基位置 | |
| 用於在某些目標平颱部署 QML 插件的前綴相對子目錄 | |
| 用於設置部署支持的文件名稱 | |
| Prefix-relative subdirectory for deploying Qt translations on some target platforms | |
| 啓用部署工具的冗餘模式 | |
| 主機 Qt 安裝的位置,當交叉編譯時 | |
| Specifies the language of translatable strings | |
| List of languages to be used for project internationalization | |
| Path to iOS launch screen storyboard used by all targets | |
| Prevents collecting of project-built shared library targets during Android deployment | |
| Prevents collecting of imported targets during Android deployment | |
| 在 iOS 目標完成期間禁用提供後備 APP 捆綁 ID | |
| 在 iOS 目標完成期間禁用提供後備團隊 ID | |
| 防止後續調用 qt_standard_project_setup() 做齣任何改變 | |
| Set of variables to specify the path to Qt for Android for the corresponding ABI | |
| Enables the use of per-target Android build directories |
| Enable verbose logging for all ifcodegen functions | |
| Search path for ifcodegen templates |
| Disables FFmpeg code-signing on iOS |
| Controls whether QML Compiler statistics collection is enabled | |
| Enables autogeneration of .qmlls.ini files for QML Language Server | |
| Disables compilation of QML files into bytecode or C++ code | |
| 默認情況下將在其下創建 QML 模塊的基輸齣目錄 |
| CMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG | Improves the dependency graph for multi-configuration generators |