qt_deploy_libexec_dir
前缀相关子目录,用于在某些目标平台上部署程序可执行文件。
此变量由QT_DEPLOY_SUPPORT 命名的脚本定义。它只能作为安装过程中部署的一部分或编译后规则使用。
注意: 这是一个低级部署 API 变量,只能在高级 API 命令(如qt_generate_deploy_app_script)未涵盖的高级用例中使用。
此变量在 Qt 6.7 中引入。
在 Unix 衍生版本中,项目应在部署脚本中使用QT_DEPLOY_LIBEXEC_DIR
,以避免硬编码特定目录来部署项目本地的辅助可执行文件。
例如,使用QtWebEngine 的项目会将QtWebEngineProcess
可执行文件部署到该目录。
QT_DEPLOY_LIBEXEC_DIR
默认值为 (通常为 ),它由 CMake 的${CMAKE_INSTALL_LIBEXECDIR}
libexec
GNUInstallDirs模块提供。要更改 的值,请确保项目在找到 软件包之前设置 。QT_DEPLOY_LIBEXEC_DIR
Core
CMAKE_INSTALL_LIBEXECDIR
QT_DEPLOY_LIBEXEC_DIR
路径是相对于QT_DEPLOY_PREFIX 的。
该变量在部署到 macOS 应用程序捆绑包时没有意义,因此不应在这种情况下使用。
示例
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_SUPPORT、QT_DEPLOY_PREFIX、QT_DEPLOY_BIN_DIR、QT_DEPLOY_LIB_DIR、QT_DEPLOY_ PLUGINS_DIR、QT_DEPLOY_QML_DIR 和QT_DEPLOY_TRANSLATIONS_DIR。
© 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.