CMake: Pierce through LINK_ONLY deps in finalizer dep traversal
Ensure that the finalizer approach of
__qt_internal_propagate_object_library considers $<LINK_ONLY:>
libraries when traversing the dependencies of a target.
The issue was discovered when using the Quick.Shapes QML module in a
static build. The module has both a backing library and a plugin.
The backing library has some resource objects associated with it.
When the targets are exported, the plugin INTERFACE_LINK_LIBRARIES
has a $<LINK_ONLY:QuickShapes> dependency.
This ensures that the library will be linked, but depending on which
linking approach in __qt_internal_propagate_object_library is used,
the resources might not be linked to the final executable.
The resources are linked correctly when using the
target_link_libraries approach, but not when using the finalizer or
target_sources approach.
This change fixes the finalizer approach, but the target_sources
approach is still broken.
Amends a1fd4f51ad
Pick-to: 6.2
Change-Id: Ifbb91a17d388c3dc4263e17ec0d3bd5627b57cb4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
bb10
parent
4fc14b1933
commit
82063d9af1
|
|
@ -177,6 +177,11 @@ function(__qt_internal_collect_object_libraries_recursively out_var target initi
|
|||
|
||||
set(object_libraries "")
|
||||
foreach(lib IN LISTS libs interface_libs)
|
||||
# Extract possible target from exported LINK_ONLY dependencies.
|
||||
# This is super important for traversing backing library dependencies of qml plugins.
|
||||
if(lib MATCHES "^\\$<LINK_ONLY:(.*)>$")
|
||||
set(lib "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if(TARGET ${lib})
|
||||
get_target_property(aliased_target ${lib} ALIASED_TARGET)
|
||||
if(aliased_target)
|
||||
|
|
|
|||
Loading…
Reference in New Issue