From 3d54f47ceaf824c5b8f2346cb9557cbc39aca9fc Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 25 Sep 2020 12:18:58 +0200 Subject: [PATCH] CMake: Generate *AdditionalTargetInfo.cmake for tools This ensures that we have the configuration-independent IMPORTED_* properties set on tools. Fixes: QTBUG-86893 Change-Id: I2b772c21341e6e4631379d4a5a99580ec96909ed Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor --- cmake/QtModuleToolsConfig.cmake.in | 1 + cmake/QtTargetHelpers.cmake | 5 ++++- cmake/QtToolHelpers.cmake | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/QtModuleToolsConfig.cmake.in b/cmake/QtModuleToolsConfig.cmake.in index 79ca620c13..498c0fca83 100644 --- a/cmake/QtModuleToolsConfig.cmake.in +++ b/cmake/QtModuleToolsConfig.cmake.in @@ -9,6 +9,7 @@ if (NOT QT_NO_CREATE_TARGETS) endif() include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake") if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS) include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@VersionlessTargets.cmake") endif() diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index c949d44930..a78a02af98 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -350,7 +350,10 @@ endif() if(target_type STREQUAL "INTERFACE_LIBRARY") continue() endif() - set(full_target ${QT_CMAKE_EXPORT_NAMESPACE}::${target}) + set(full_target ${target}) + if(NOT full_target MATCHES "^${QT_CMAKE_EXPORT_NAMESPACE}::") + string(PREPEND full_target "${QT_CMAKE_EXPORT_NAMESPACE}::") + endif() set(properties_retrieved TRUE) if(NOT "${uc_release_cfg}" STREQUAL "") string(APPEND content "get_target_property(_qt_imported_location ${full_target} IMPORTED_LOCATION_${uc_release_cfg})\n") diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake index d1d8fa8b76..ac5412461d 100644 --- a/cmake/QtToolHelpers.cmake +++ b/cmake/QtToolHelpers.cmake @@ -302,6 +302,10 @@ endif() NAMESPACE "${QT_CMAKE_EXPORT_NAMESPACE}::" DESTINATION "${config_install_dir}") + qt_internal_export_additional_targets_file( + TARGETS ${tool_targets} + EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target} + CONFIG_INSTALL_DIR "${config_install_dir}") # Create versionless targets file. configure_file(