qt5base-lts/cmake/QtPublicFinalizerHelpers.cmake
Alexey Edelev 19e789bace Implement propagation of object files to the end-point executable
This proposal collects all the resource objects to the qt-specific
property of the static libraries. This is done to avoid littering
of other static libraries and put resource object files to the
source part of the linker line when linking the end-point
executable.
The way we link object resource libraries is changed back to the
target_link_libraries approach as we may omit using finalizers
with linkers other than ld. Users may enforce finalizers by calling
the qt6_enable_resource_objects_finalizer_mode function if need.

Refactor tests related to the static resources.

Amends ddaa7150d8

Task-number: QTBUG-93002
Change-Id: I74135e291cd82fb54d1b284b4b4a1e002b1fef98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-27 14:28:17 +02:00

21 lines
826 B
CMake

# Helper to check if the finalizer mode should be used.
# If true or unset, use finalizer mode.
# If false, use regular mode (usage requirement propagation via associated Qt module)
function(__qt_internal_check_finalizer_mode target out_var finalizer)
get_target_property(value ${target} _qt_${finalizer}_finalizer_mode)
if("${value}" STREQUAL "value-NOTFOUND")
set_property(TARGET "${target}" PROPERTY _qt_${finalizer}_finalizer_mode "TRUE")
set(value TRUE)
endif()
set(${out_var} "${value}" PARENT_SCOPE)
endfunction()
function(__qt_internal_enable_finalizer_mode target finalizer enabled)
if(enabled)
set(enabled "TRUE")
else()
set(enabled "FALSE")
endif()
set_property(TARGET "${target}" PROPERTY _qt_${finalizer}_finalizer_mode "${enabled}")
endfunction()