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
|
模塊導入目標的名稱:
Qt5::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
.
|
|
|
Hides commands that start with
qt_
, leaving only the versioned ones starting with
qt6_
.
|
|
|
Hides the imported targets starting with
Qt::
. Instead, you need to use the targets starting with
Qt6::
.
|
QT_VISIBILITY_AVAILABLE
|
在 Unix,布爾描述 Qt 庫和插件是否被編譯采用
-fvisibility=hidden
。這意味著僅選中符號被導齣。
|
These variables can influence CMake commands provided by Qt. They may be set by the project, a toolchain file or other third-party packages.
| ANDROID_NDK_HOST_SYSTEM_NAME | Android-specific architecture of the host system |
| ANDROID_SDK_ROOT | Location of the Android SDK |
| QT_ANDROID_ABIS | List of ABIs that the project packages are built for |
| QT_ANDROID_APPLICATION_ARGUMENTS | List of arguments to pass to Android applications |
| QT_ANDROID_BUILD_ALL_ABIS | Enables building multi-ABI packages using the autodetected Qt for Android SDK list |
| QT_ANDROID_DEPLOY_RELEASE | Set the package type as a release |
| QT_ANDROID_MULTI_ABI_FORWARD_VARS | Allows to share CMake variables in multi-ABI builds |
| QT_ANDROID_SIGN_AAB | Sign the .aab package with the specified keystore, alias and store password |
| QT_ANDROID_SIGN_APK | Sign the package with the specified keystore, alias and store password |
| QT_DEPLOY_BIN_DIR | Prefix-relative subdirectory for deploying runtime binaries on some target platforms |
| QT_DEPLOY_IGNORED_LIB_DIRS | Directories that are excluded from runtime dependencies search |
| QT_DEPLOY_LIB_DIR | Prefix-relative subdirectory for deploying libraries on some target platforms |
| QT_DEPLOY_PLUGINS_DIR | Prefix-relative subdirectory for deploying Qt plugins on some target platforms |
| QT_DEPLOY_PREFIX | Base location for a deployment |
| QT_DEPLOY_QML_DIR | Prefix-relative subdirectory for deploying QML plugins on some target platforms |
| QT_DEPLOY_SUPPORT | Name of the file to include for setting up deployment support |
| QT_DEPLOY_TRANSLATIONS_DIR | Prefix-relative subdirectory for deploying Qt translations on some target platforms |
| QT_ENABLE_VERBOSE_DEPLOYMENT | Enables verbose mode of deployment tools |
| QT_HOST_PATH | Location of the host Qt installation when cross-compiling |
| QT_IOS_LAUNCH_SCREEN | Path to iOS launch screen storyboard used by all targets |
| QT_NO_COLLECT_BUILD_TREE_APK_DEPS | Prevents collecting of project-built shared library targets during Android deployment |
| QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS | Prevents collecting of imported targets during Android deployment |
| QT_NO_SET_XCODE_BUNDLE_IDENTIFIER | Disables providing a fallback app bundle ID during target finalization on iOS |
| QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID | Disables providing a fallback team ID during target finalization on iOS |
| QT_NO_STANDARD_PROJECT_SETUP | Prevents subsequent calls to qt_standard_project_setup() from making any changes |
| QT_PATH_ANDROID_ABI_<ABI> | Set of variables to specify the path to Qt for Android for the corresponding ABI |
| QT_QML_OUTPUT_DIRECTORY | Base output directory below which QML modules will be created by default |
| IFCODEGEN_VERBOSE | Enable verbose logging for all ifcodegen functions |
| QT_IFCODEGEN_TEMPLATE_SEARCH_PATH | Search path for ifcodegen templates |