CMake 命令参考

Qt6::Core

qt_add_android_permission

为目标可执行文件添加 Android 权限

qt_add_big_resources

将大型二进制资源编译为目标代码

qt_add_binary_resources

从 Qt 资源文件列表创建 RCC 文件

qt_add_executable

创建并最终确定平台特定类型的应用程序目标

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 文件

Qt6::DBus

qt_add_dbus_adaptor

为 D-Bus 接口生成适配器类

qt_add_dbus_interface

为 D-Bus 接口描述文件生成实现接口的 C++ 源代码

qt_add_dbus_interfaces

为 D-Bus 接口描述文件生成实现接口的 C++ 源代码

qt_generate_dbus_interface

从头文件生成 D-Bus 接口

Qt6::Grpc

qt_add_grpc

使用 Protobuf 模式生成基于 Qt 的 C++ 服务

Qt6::InterfaceFramework

qt_ifcodegen_add_plugin

添加插件目标,该目标由 ifcodegen 使用 qface IDL 文件生成

qt_ifcodegen_add_qml_module

添加 QML 模块,该模块由 ifcodegen 使用 qface IDL 文件生成

qt_ifcodegen_extend_target

用 qface IDL 文件生成的文件扩展目标模块

qt_ifcodegen_generate

从 qface IDL 文件生成文件

qt_ifcodegen_import_variables

从 qface IDL 文件生成文件,并提供变量供 CMake 使用

qt_set_ifcodegen_variable

在 ifcodegen 模板中将变量设置为给定值

Qt6::LinguistTools

qt_add_lrelease

添加将Qt Linguist.ts 文件转换为 .qm 文件的目标

qt_add_lupdate

添加生成或更新Qt Linguist.ts 文件的目标

qt_add_translation

Qt Linguist.ts 文件编译成 .qm 文件

qt_add_translations

添加目标以更新和转换Qt Linguist.ts 文件为 .qm 文件

qt_collect_translation_source_targets

收集符合翻译条件的目标

qt_create_translation

设置Qt Linguist 翻译工具链

Qt6::Multimedia

qt_add_ios_ffmpeg_libraries

在 iOS 应用程序捆绑包中嵌入 FFmpeg 二进制文件的辅助函数

Qt6::Protobuf

qt_add_protobuf

使用 Protobuf 模式生成基于 Qt 的 C++ 源代码

Qt6::Qml

qt_add_qml_module

定义 QML 模块

qt_add_qml_plugin

定义与 QML 模块相关的插件

qt_deploy_qml_imports

部署可执行文件所需的 QML 模块运行时组件

qt_generate_deploy_qml_app_script

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

qt_generate_foreign_qml_types

在 QML 模块中注册来自一个目标的类型

qt_import_qml_plugins

确保在静态构建时导入目标所需的 QML 插件

qt_query_qml_module

检索有关 QML 模块的信息

qt_target_compile_qml_to_cpp

qt_target_qml_sources

向现有 QML 模块目标添加 qml 文件和资源

Qt6::RemoteObjects

qt_add_repc_merged

Qt Remote Objects.rep 文件为源代码和副本类型创建 C++ 头文件

qt_add_repc_replicas

Qt Remote Objects.rep 文件为复制类型创建 C++ 头文件

qt_add_repc_sources

Qt Remote Objects.rep 文件为源类型创建 C++ 头文件

qt_reps_from_headers

从 QObject 头文件创建 .rep 文件

Qt6::Scxml

Qt6::ShaderTools

Qt Shader Tools Build System Integration

编译着色器并将其添加到 Qt 资源中

Qt6::WaylandClient

qt_generate_wayland_protocol_client_sources

为 Wayland 协议 .XML 文件生成客户端 C++ 绑定

Qt6::WaylandCompositor

qt_generate_wayland_protocol_server_sources

为 Wayland 协议 .XML 文件创建服务器端 C++ 绑定

Qt6::WebEngineCore

qt_add_webengine_dictionary

将 hunspell 字典格式转换为 bdict 二进制格式

Qt6::Widgets

qt_add_ui

向目标添加 .ui 文件

qt_wrap_ui

为 .ui 文件创建源代码

© 2025 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.