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

Pick-to: 6.8
Task-number: QTBUG-126727
Change-Id: I22618a51bd98cc851ec1a01a27086e0b878bee8d
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2024-07-01 16:32:41 +02:00
parent 9fe100e270
commit 16f49f6a1c

View File

@ -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)