summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6CoreMacros.cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-05-28 14:02:29 +0200
committerAlexey Edelev <alexey.edelev@qt.io>2021-05-31 20:50:07 +0200
commita1fd4f51ada82854f35654158a334454e760a9f7 (patch)
tree0160c0ac05783bb51c2e425d67c138d5bb6bc77d /src/corelib/Qt6CoreMacros.cmake
parent64d6003f498d7259325719daba021d86d8deda95 (diff)
Rework resource finalizer approach
In the previous implementation of the resource object finalizer, we used the name of the resource object library without namespaces when recording it in the resource libraries list. This causes an issue when we or users export resource targets. This approach marks resource object libraries with the exporting property instead of collecting resource targets when creating them. Amends 19e789bace887105badae83c0a79429bbf8e8221 Change-Id: I8596815921f2c681ddd78d9b2e9a4e1cafe5000b Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/Qt6CoreMacros.cmake')
-rw-r--r--src/corelib/Qt6CoreMacros.cmake19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 91fa4590c7..57c730b42d 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -1452,20 +1452,19 @@ function(__qt_propagate_generated_resource target resource_name generated_source
# After internal discussion we decided to not rely on the linker order that CMake
# offers, until CMake provides the guaranteed linking order that suites our needs in a
# future CMake version.
- # The _qt_resource_object_libraries collects all resource targets owned by the 'target'
- # instead of the implicit propagating and is used by the executable finalizer to expose
- # objects as the end-point sources. If the user prefers not to use a finalizer or the CMake
- # version does not support DEFER calls, fall back to interface linking of the resource
- # objects.
+ # All resource object libraries mark themselves with the _is_qt_resource_target property.
+ # Using a finalizer approach we walk through the target dependencies and look for
+ # resource libraries using the _is_qt_resource_target property. Then, resource objects of
+ # the collected libraries are moved to the beginnig of the linker line using target_sources.
+ #
# target_link_libraries works well with linkers other than ld. If user didn't enforce
# a finalizer we rely on linker to resolve circular dependencies between resource
# objects and static libraries.
- set_property(TARGET ${target} APPEND PROPERTY
- _qt_resource_object_libraries ${resource_target}
- )
- set_property(TARGET ${target} APPEND PROPERTY
- EXPORT_PROPERTIES _qt_resource_object_libraries
+ set_property(TARGET ${resource_target} PROPERTY _is_qt_resource_target TRUE)
+ set_property(TARGET ${resource_target} APPEND PROPERTY
+ EXPORT_PROPERTIES _is_qt_resource_target
)
+
# Keep the implicit linking if finalizers are not used.
set(finalizer_mode_condition
"$<NOT:$<BOOL:$<TARGET_PROPERTY:_qt_resource_objects_finalizer_mode>>>"