From a0c9fc67586c6dff72c9cb4b30b659c11e7186c2 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 15 Nov 2023 17:29:21 +0100 Subject: [PATCH] CMake: Add a way to pass additional arguments to win/macdeployqt [ChangeLog][CMake] Added the DEPLOY_TOOL_OPTIONS argument to the functions qt_generate_deploy_app_script and qt_deploy_runtime_dependencies. It doesn't make sense to map every option of the deployment tools to arguments in our CMake deployment API. Allow the user to specify extra arguments to windeployqt or macdeployqt. Task-number: QTBUG-116551 Change-Id: I4cc67ab03f19101b695281e8c80f8af825bab7f6 Reviewed-by: Alexandru Croitor --- src/corelib/Qt6CoreDeploySupport.cmake | 3 +++ src/corelib/Qt6CoreMacros.cmake | 1 + src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc | 4 ++++ src/corelib/doc/src/cmake/qt_generate_deploy_app_script.qdoc | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/src/corelib/Qt6CoreDeploySupport.cmake b/src/corelib/Qt6CoreDeploySupport.cmake index aeda7405be..e189b26538 100644 --- a/src/corelib/Qt6CoreDeploySupport.cmake +++ b/src/corelib/Qt6CoreDeploySupport.cmake @@ -316,6 +316,7 @@ function(qt6_deploy_runtime_dependencies) ADDITIONAL_LIBRARIES ADDITIONAL_MODULES ${file_GRD_options} + DEPLOY_TOOL_OPTIONS ) cmake_parse_arguments(PARSE_ARGV 0 arg "${no_value_options}" "${single_value_options}" "${multi_value_options}" @@ -403,6 +404,7 @@ function(qt6_deploy_runtime_dependencies) if(arg_NO_COMPILER_RUNTIME) list(APPEND tool_options --no-compiler-runtime) endif() + list(APPEND tool_options ${arg_DEPLOY_TOOL_OPTIONS}) elseif(__QT_DEPLOY_SYSTEM_NAME STREQUAL Darwin) set(extra_binaries_option "-executable=") if(NOT arg_NO_APP_STORE_COMPLIANCE) @@ -411,6 +413,7 @@ function(qt6_deploy_runtime_dependencies) if(NOT arg_NO_OVERWRITE) list(APPEND tool_options -always-overwrite) endif() + list(APPEND tool_options ${arg_DEPLOY_TOOL_OPTIONS}) endif() # This is an internal variable. It is normally unset and is only intended diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index dbafe06dc5..e80bf0bbac 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -3267,6 +3267,7 @@ function(qt6_generate_deploy_app_script) ) set(qt_deploy_runtime_dependencies_options # These options are forwarded as is to qt_deploy_runtime_dependencies. + DEPLOY_TOOL_OPTIONS PRE_INCLUDE_REGEXES PRE_EXCLUDE_REGEXES POST_INCLUDE_REGEXES diff --git a/src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc b/src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc index 2eac3f3199..96f53cd571 100644 --- a/src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc +++ b/src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc @@ -39,6 +39,7 @@ qt_deploy_runtime_dependencies( [NO_APP_STORE_COMPLIANCE] [NO_TRANSLATIONS] [NO_COMPILER_RUNTIME] + [DEPLOY_TOOL_OPTIONS] [PRE_INCLUDE_REGEXES regexes...] [PRE_EXCLUDE_REGEXES regexes...] [POST_INCLUDE_REGEXES regexes...] @@ -132,6 +133,9 @@ in a customized way. For Windows desktop applications, the required runtime files for the compiler are also installed by default. To prevent this, specify \c{NO_COMPILER_RUNTIME}. +You can use \c{DEPLOY_TOOL_OPTIONS} to pass additional options to the underlying +deployment tool. + On Linux, deploying runtime dependencies is based on CMake's \c{file(GET_RUNTIME_DEPENDENCIES)} command. The options \c{PRE_INCLUDE_REGEXES}, \c{PRE_EXCLUDE_REGEXES}, \c{POST_INCLUDE_REGEXES}, \c{POST_EXCLUDE_REGEXES}, diff --git a/src/corelib/doc/src/cmake/qt_generate_deploy_app_script.qdoc b/src/corelib/doc/src/cmake/qt_generate_deploy_app_script.qdoc index f52a0f1661..f0cea57072 100644 --- a/src/corelib/doc/src/cmake/qt_generate_deploy_app_script.qdoc +++ b/src/corelib/doc/src/cmake/qt_generate_deploy_app_script.qdoc @@ -24,6 +24,7 @@ qt_generate_deploy_app_script( [NO_TRANSLATIONS] [NO_COMPILER_RUNTIME] [NO_UNSUPPORTED_PLATFORM_ERROR] + [DEPLOY_TOOL_OPTIONS ...] [PRE_INCLUDE_REGEXES regexes...] [PRE_EXCLUDE_REGEXES regexes...] [POST_INCLUDE_REGEXES regexes...] @@ -74,6 +75,9 @@ customized way. For Windows desktop applications, the required runtime files for the compiler are also installed by default. To prevent this, specify \c{NO_COMPILER_RUNTIME}. +You can use \c{DEPLOY_TOOL_OPTIONS} to pass additional options to the underlying +deployment tool. + For deploying a QML application, use \l{qt6_generate_deploy_qml_app_script}{qt_generate_deploy_qml_app_script()} instead.