From 1c633d68b417a5278724e3be3af9e66b127d1f85 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 1 Jul 2024 16:32:41 +0200 Subject: [PATCH] CMake: Add IMPORTED_LINK_DEPENDENT_LIBRARIES for versionless targets When creating non-aliased versionless targets, make sure we also add the config-specific IMPORTED_LINK_DEPENDENT_LIBRARIES properties, so that for older CMake versions, we still get the -rpath-link handling of the dependent libraries. Amends 173164cd477211e574c0d04abef51aa0f4c3f78d Task-number: QTBUG-126727 Change-Id: I22618a51bd98cc851ec1a01a27086e0b878bee8d Reviewed-by: Alexey Edelev (cherry picked from commit 16f49f6a1c58919fb15c82d8381d7fc0ff5557ad) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtPublicCMakeHelpers.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmake/QtPublicCMakeHelpers.cmake b/cmake/QtPublicCMakeHelpers.cmake index 643a0d2926b..5bb260c5383 100644 --- a/cmake/QtPublicCMakeHelpers.cmake +++ b/cmake/QtPublicCMakeHelpers.cmake @@ -387,6 +387,10 @@ endfunction() # It assigns the known properties from the versioned targets to the versionless created in this # function. This allows versionless targets mimic the versioned. function(_qt_internal_create_versionless_targets targets install_namespace) + set(known_imported_properties + IMPORTED_LINK_DEPENDENT_LIBRARIES + ) + set(known_interface_properties QT_MAJOR_VERSION AUTOMOC_MACRO_NAMES @@ -479,6 +483,15 @@ function(_qt_internal_create_versionless_targets targets install_namespace) endif() set_property(TARGET Qt::${target} PROPERTY IMPORTED_LOCATION${config} "${target_imported_location}") + + foreach(property IN LISTS known_imported_properties) + get_target_property(exported_property_value + ${install_namespace}::${target} ${property}${config}) + if(exported_property_value) + set_property(TARGET Qt::${target} APPEND PROPERTY + ${property} "${exported_property_value}") + endif() + endforeach() endforeach() foreach(property IN LISTS known_qt_exported_properties)