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 |