Qt6 Core 中的 CMake 命令

当加载 Qt6::Core 时(例如通过

find_package(Qt6 REQUIRED COMPONENTS Core)

另请参阅 《CMake 命令参考》。

qt_add_android_dynamic_feature_java_source_dirs

将 Java 源代码目录添加到动态功能构建中。

qt_add_android_permission

将 Android 权限添加到目标可执行文件中。

qt_add_big_resources

将大型二进制资源编译为对象代码。

qt_add_binary_resources

根据 Qt 资源文件列表创建 RCC 文件。

qt_add_executable

创建并最终确定一个特定于平台的应用程序目标。

qt_add_harmonyos_permission

向目标可执行文件添加 HarmonyOS 权限。

qt_add_library

创建并最终生成一个库。

qt_add_plugin

创建一个 Qt 插件目标。

qt_add_resources

将二进制资源编译为源代码。

qt_add_win_app_sdk

将 Windows App SDK 库添加到应用程序中。

qt_allow_non_utf8_sources

防止在 Windows 上强制将源文件视为 UTF-8。

qt_android_add_apk_target

定义一个运行 androiddeployqt 以生成 APK 的构建目标。

qt_android_apply_arch_suffix

将目标二进制文件的名称配置为包含特定于架构的后缀。

qt_android_generate_deployment_settings

生成 androiddeployqt 所需的部署设置文件。

qt_deploy_qt_conf

在部署时写入一个 qt.conf 文件。

qt_deploy_runtime_dependencies

部署可执行文件所需的 Qt 插件、Qt 及非 Qt 库。

qt_deploy_translations

部署可执行文件所需的 Qt 翻译。

qt_disable_unicode_defines

防止某些与 Unicode 相关的编译器定义在目标上被自动设置。

qt_extract_metatypes

从 Qt 目标中提取元类型,并生成相关的 metatypes.json 文件。

qt_finalize_project

处理与 Qt 项目相关的各种常见平台特定任务。

qt_finalize_target

处理与 Qt 目标相关的各种常见平台特定任务。

qt_generate_deploy_app_script

为应用程序生成部署脚本。

qt_generate_deploy_script

生成自定义部署脚本。

qt_generate_moc

对输入文件调用 moc。

qt_import_plugins

指定要导入或排除的自定义插件集。

qt_policy

修改 Qt CMake API 的默认行为。

qt_set_finalizer_mode

自定义目标的终结处理。

qt_standard_project_setup

将项目范围内的默认设置配置为标准布局。

qt_wrap_cpp

从源代码生成 .moc 文件。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.