mirror of https://github.com/qt/qtbase.git
CMake: Write link dependencies into AdditionalTargetInfo.cmake file
When a shared library target has private dependencies to another shared library, they are exported by CMake into the target's IMPORTED_LINK_DEPENDENT_LIBRARIES_<CONFIG> property. This property then is read by the consuming project to determine which file paths need to be added to the -rpath-link linker option. Due to the simple logic that CMake uses to process this property, if the project CMAKE_BUILD_TYPE does not match the _<CONFIG> part of the property, the dependent libraries will not be added to -rpath-link, causing link failures. Make sure we explicitly set all the possible variants of the property in our custom Qt6FooAdditionalTargetInfo.cmake file, to ensure we always pick up the relevant dependent libraries for processing. In conjunction with173164cd47
and1c287cea29
in qtbase, this should hopefully avoid most -rpath-linking issues for QNX and Yocto builds. Pick-to: 6.8 Task-number: QTBUG-126727 Change-Id: I16a9cb5553d57e5ea3edc28cc2aab89c77f02a75 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
e17245505e
commit
9fe100e270
|
@ -968,6 +968,7 @@ endif()\n")
|
|||
set(write_implib FALSE)
|
||||
set(write_soname FALSE)
|
||||
set(write_objects FALSE)
|
||||
set(write_link_dependencies FALSE)
|
||||
set(write_location TRUE)
|
||||
|
||||
if(target_type STREQUAL "SHARED_LIBRARY")
|
||||
|
@ -978,6 +979,7 @@ endif()\n")
|
|||
else()
|
||||
set(write_soname TRUE)
|
||||
endif()
|
||||
set(write_link_dependencies TRUE)
|
||||
elseif(target_type STREQUAL "OBJECT_LIBRARY")
|
||||
set(write_objects TRUE)
|
||||
set(write_location FALSE)
|
||||
|
@ -993,6 +995,9 @@ endif()\n")
|
|||
if(write_soname)
|
||||
string(APPEND content "get_target_property(_qt_imported_soname ${full_target} IMPORTED_SONAME_${uc_release_cfg})\n")
|
||||
endif()
|
||||
if(write_link_dependencies)
|
||||
string(APPEND content "get_target_property(_qt_imported_link_dependencies ${full_target} IMPORTED_LINK_DEPENDENT_LIBRARIES_${uc_release_cfg})\n")
|
||||
endif()
|
||||
if(write_objects)
|
||||
string(APPEND content "get_target_property(_qt_imported_objects ${full_target} IMPORTED_OBJECTS_${uc_release_cfg})\n")
|
||||
# We generate CLR props as well, because that's what CMake generates for object
|
||||
|
@ -1009,6 +1014,9 @@ endif()\n")
|
|||
if(write_soname)
|
||||
string(APPEND content "get_target_property(_qt_imported_soname_default ${full_target} IMPORTED_SONAME_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
|
||||
endif()
|
||||
if(write_link_dependencies)
|
||||
string(APPEND content "get_target_property(_qt_imported_link_dependencies_default ${full_target} IMPORTED_LINK_DEPENDENT_LIBRARIES_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
|
||||
endif()
|
||||
if(write_objects)
|
||||
string(APPEND content "get_target_property(_qt_imported_objects_default ${full_target} IMPORTED_OBJECTS_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
|
||||
string(APPEND content "get_target_property(_qt_imported_clr_default ${full_target} IMPORTED_COMMON_LANGUAGE_RUNTIME_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
|
||||
|
@ -1043,6 +1051,12 @@ endif()")
|
|||
string(APPEND content "
|
||||
if(_qt_imported_soname${var_suffix})
|
||||
set_property(TARGET ${full_target} PROPERTY IMPORTED_SONAME${property_suffix} \"$\{_qt_imported_soname${var_suffix}}\")
|
||||
endif()")
|
||||
endif()
|
||||
if(write_link_dependencies)
|
||||
string(APPEND content "
|
||||
if(_qt_imported_link_dependencies${var_suffix})
|
||||
set_property(TARGET ${full_target} PROPERTY IMPORTED_LINK_DEPENDENT_LIBRARIES${property_suffix} \"$\{_qt_imported_link_dependencies${var_suffix}}\")
|
||||
endif()")
|
||||
endif()
|
||||
if(write_objects)
|
||||
|
@ -1065,6 +1079,8 @@ unset(_qt_imported_location)
|
|||
unset(_qt_imported_location_default)
|
||||
unset(_qt_imported_soname)
|
||||
unset(_qt_imported_soname_default)
|
||||
unset(_qt_imported_link_dependencies)
|
||||
unset(_qt_imported_link_dependencies_default)
|
||||
unset(_qt_imported_objects)
|
||||
unset(_qt_imported_objects_default)
|
||||
unset(_qt_imported_clr)
|
||||
|
|
Loading…
Reference in New Issue