diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-03-29 15:28:16 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-04-08 11:29:29 +0200 |
commit | 4ed9402d7a752c739a371706fd5cd82e4626539e (patch) | |
tree | 93ee391a424a43524475109180e7292177808f12 /cmake | |
parent | 9224f8e99fd8be0aaf5971783af4e32e3795ca24 (diff) |
Fix linking order of the resource objects
The generated object resource library depends on the Qt::Core library
because uses the functions defined in qresource.cpp. Dummy linking of
the Qt::Core to an object library has an effect only when the object
library is linked directly to the executable as a target. If we link
the object library as INTERFACE library we miss out all the objects
that need to be linked to the executable. This behavior is explained
here:
https://bit.ly/3sFWKvI
Thus, the only option to link the object library objects to the
endpoint executable is to use TARGET_OBJECTS property in genex, as
it's already done. But that means we are losing all profits that
target actually has, especially linking the object library dependencies.
The combination of both of the above methods does the job. The only
thing that looks fragile so far is order. Currently, the order we
use in the target_link_library call applies to the linker command line.
This means the object library objects must always appear before the
object library target.
Change-Id: If1f0e35e0445d5e96a1f2249ab44114cd36630e9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtPrlHelpers.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmake/QtPrlHelpers.cmake b/cmake/QtPrlHelpers.cmake index 0c0b7a2aec..0aab301053 100644 --- a/cmake/QtPrlHelpers.cmake +++ b/cmake/QtPrlHelpers.cmake @@ -187,7 +187,7 @@ function(qt_internal_walk_libs if(lib_rcc_objects_${target}) qt_merge_libs(rcc_objects ${lib_rcc_objects_${target}}) endif() - else() + elseif(NOT lib_target_type STREQUAL "OBJECT_LIBRARY") qt_merge_libs(libs "$<TARGET_LINKER_FILE:${lib_target}>") get_target_property(target_rcc_objects "${lib_target}" _qt_rcc_objects) |