diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-25 15:16:19 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-29 17:03:28 +0200 |
commit | 82063d9af1f9ad6cddab4d5526316816cbe1a77c (patch) | |
tree | ffbffa8a44d61a4ab8c2aad2cf3bb466f76da8f5 /cmake/QtPublicTargetHelpers.cmake | |
parent | 4fc14b19336531c96f5883ff4b06f9af1ddaa30d (diff) | |
download | qtbase-82063d9af1f9ad6cddab4d5526316816cbe1a77c.tar.gz |
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 a1fd4f51ada82854f35654158a334454e760a9f7
Pick-to: 6.2
Change-Id: Ifbb91a17d388c3dc4263e17ec0d3bd5627b57cb4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtPublicTargetHelpers.cmake')
-rw-r--r-- | cmake/QtPublicTargetHelpers.cmake | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/QtPublicTargetHelpers.cmake b/cmake/QtPublicTargetHelpers.cmake index 5f09e97e0f..a116d2dd5d 100644 --- a/cmake/QtPublicTargetHelpers.cmake +++ b/cmake/QtPublicTargetHelpers.cmake @@ -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) |