From 266c2d23ae01ab452b7396df5a1d06dacb3149d5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 25 Sep 2023 09:42:47 +0200 Subject: [PATCH] CMake: Store info about the debug build in QtDeploySupport.cmake Application deployment must know whether the Qt installation is a debug_and_release build - or more generally, a multi-config build with a debug configuration. Store the following information in QtDeploySupport.cmake that's read at installation time: - whether Qt was built multi-config with a debug configuration - the postfix for debug libraries Task-number: QTBUG-109444 Pick-to: 6.5 6.6 Change-Id: I96a2120ba1a2b03125661cc829498653e37dfb0f Reviewed-by: Alexey Edelev --- src/corelib/Qt6CoreConfigExtras.cmake.in | 1 + src/corelib/Qt6CoreMacros.cmake | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/corelib/Qt6CoreConfigExtras.cmake.in b/src/corelib/Qt6CoreConfigExtras.cmake.in index 4a9f72a049..9436ae04cf 100644 --- a/src/corelib/Qt6CoreConfigExtras.cmake.in +++ b/src/corelib/Qt6CoreConfigExtras.cmake.in @@ -32,6 +32,7 @@ list(REMOVE_DUPLICATES CMAKE_AUTOMOC_MACRO_NAMES) include("${CMAKE_CURRENT_LIST_DIR}/QtInstallPaths.cmake") set(QT@PROJECT_VERSION_MAJOR@_IS_SHARED_LIBS_BUILD "@BUILD_SHARED_LIBS@") +set(QT@PROJECT_VERSION_MAJOR@_DEBUG_POSTFIX "@CMAKE_DEBUG_POSTFIX@") set(_Qt6CTestMacros "${CMAKE_CURRENT_LIST_DIR}/Qt6CTestMacros.cmake") diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 24ff7911e1..604bb47cc0 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -2788,6 +2788,18 @@ function(_qt_internal_setup_deploy_support) set(__QT_DEPLOY_TOOL "") endif() + # Determine whether this is a multi-config build with a Debug configuration. + set(is_multi_config_build_with_debug_config FALSE) + get_target_property(target_is_imported ${target} IMPORTED) + if(target_is_imported) + get_target_property(target_imported_configs ${target} IMPORTED_CONFIGURATIONS) + list(LENGTH target_imported_configs target_imported_configs_length) + if(target_imported_configs_length GREATER "1" + AND "DEBUG" IN_LIST target_imported_configs) + set(is_multi_config_build_with_debug_config TRUE) + endif() + endif() + _qt_internal_add_deploy_support("${CMAKE_CURRENT_LIST_DIR}/Qt6CoreDeploySupport.cmake") set(deploy_ignored_lib_dirs "") @@ -2885,6 +2897,8 @@ set(__QT_DEPLOY_PLUGINS \"\") set(__QT_DEPLOY_MUST_ADJUST_PLUGINS_RPATH \"${must_adjust_plugins_rpath}\") set(__QT_DEPLOY_USE_PATCHELF \"${QT_DEPLOY_USE_PATCHELF}\") set(__QT_DEPLOY_PATCHELF_EXECUTABLE \"${QT_DEPLOY_PATCHELF_EXECUTABLE}\") +set(__QT_DEPLOY_QT_IS_MULTI_CONFIG_BUILD_WITH_DEBUG \"${is_multi_config_build_with_debug_config}\") +set(__QT_DEPLOY_QT_DEBUG_POSTFIX \"${QT6_DEBUG_POSTFIX}\") # Define the CMake commands to be made available during deployment. set(__qt_deploy_support_files