qt_deploy_support
为设置部署支持而包含的文件名。
此变量在 Qt 6.3 中引入。
注意: 此变量为技术预览版,在未来版本中可能会更改。
注意: 项目代码不得修改此变量的值。
此 configure-phase 变量由 Core 软件包设置。它旨在用作任何部署脚本的第一行,以确保访问 Qt 提供的部署 API。此类部署脚本不会在 CMake 的配置阶段运行。它们会在安装过程中或作为编译后规则的一部分执行。
下面的示例展示了安装应用程序时使用该变量及其运行时依赖项的一种方式:
cmake_minimum_required(VERSION 3.16...3.22) project(MyThings) # The following CMAKE_INSTALL_*DIR variables are used to initialize their # QT_DEPLOY_*_DIR counterparts. set(CMAKE_INSTALL_BINDIR "mybindir") set(CMAKE_INSTALL_LIBDIR "mylibdir") set(CMAKE_INSTALL_LIBEXECDIR "mylibexecdir") find_package(Qt6 REQUIRED COMPONENTS Core) qt_standard_project_setup() qt_add_executable(MyApp main.cpp) set(deploy_script "${CMAKE_CURRENT_BINARY_DIR}/deploy_MyApp.cmake") file(GENERATE OUTPUT ${deploy_script} CONTENT " set(QT_DEPLOY_PLUGINS_DIR \"mypluginsdir\") set(QT_DEPLOY_QML_DIR \"myqmldir\") set(QT_DEPLOY_TRANSLATIONS_DIR \"i18n\") include(\"${QT_DEPLOY_SUPPORT}\") qt_deploy_runtime_dependencies( EXECUTABLE \"\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:MyApp>\" )") install(SCRIPT ${deploy_script})
另请参阅 qt_deploy_runtime_dependencies()和qt_deploy_qml_imports()。
© 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.