diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-08-05 16:49:42 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-08-14 12:58:11 +0200 |
commit | e8859b732dcefcdc46b66b5518e64feae29d35c4 (patch) | |
tree | 03c2244f1b6a24eef7f3dd4b88c52b7123dc7fe7 /tests | |
parent | f1641ed814462f2333f879f9e7d840303734c9f2 (diff) |
CMake: Remove qt6_enable_object_libraries_finalizer_mode
qt6_enable_object_libraries_finalizer_mode is not needed anymore
now that static Qt builds require CMake 3.21 and thus CMake takes
care of placing object library object files at the beginning of
the link line.
Rename qt6_enable_import_plugins_finalizer_mode to a more generic
qt6_set_finalizer_mode that can enable or disable multiple
different modes.
For now the only available mode is "static_plugins" which handles
the behavior of the old function name.
The mode can be enabled by calling
qt6_set_finalizer_mode(${target} ENABLE MODES "static_plugins")
Note that the function is re-tagged as being in Technical Preview.
Ideally we would not need it at all. But we need to provide some
workaround for the limitations of linking Qt static plugins in CMake
on Linux-y platforms that use bfd ld or ld.gold.
The workaround does not work well with dependencies wrapped in
generator expressions which is why we can't confidently advertise it
as a proper solution.
Our hope is that this can be fixed in future upstream CMake versions
and the function can be removed.
See 6fcc272ac9dcf1d6d65de1bdf3138722ba63a902 for details.
Adjust the tests due to the renamed and removed functions.
Amends 19e789bace887105badae83c0a79429bbf8e8221
Amends cdbb390c4a9b8d53cfcfd0884e6720423ce5e126
Amends a25027eecb3829a65543d0e8ab00c74e1b1a21c5
Amends 6fcc272ac9dcf1d6d65de1bdf3138722ba63a902
Amends a3c430f390b379d874916d4c9ff02af5323af1bd
Fixes: QTBUG-95169
Task-number: QTBUG-95601
Task-number: QTBUG-95603
Change-Id: I51b85f776ec29fc04fed1a637eba7d1f60609e69
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5161d8d525650ac74a3571b13bb8b35dbf413e59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/cmake/test_import_plugins/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/auto/cmake/test_static_resources/test_static_resources_propagation/CMakeLists.txt | 45 |
2 files changed, 31 insertions, 22 deletions
diff --git a/tests/auto/cmake/test_import_plugins/CMakeLists.txt b/tests/auto/cmake/test_import_plugins/CMakeLists.txt index ecfa7a0777..044805a85a 100644 --- a/tests/auto/cmake/test_import_plugins/CMakeLists.txt +++ b/tests/auto/cmake/test_import_plugins/CMakeLists.txt @@ -38,12 +38,12 @@ function(create_test_executable target) add_test(test_${target_name_adjusted} ${target_name_adjusted}) if(arg_FINALIZER_MODE) - set(finalizer_mode "TRUE") + set(finalizer_mode_state "ENABLE") else() - set(finalizer_mode "FALSE") + set(finalizer_mode_state "DISABLE") endif() - qt_enable_import_plugins_finalizer_mode(${target_name_adjusted} ${finalizer_mode}) + qt_set_finalizer_mode(${target_name_adjusted} ${finalizer_mode_state} MODES static_plugins) set(target ${target_name_adjusted} PARENT_SCOPE) endfunction() @@ -73,7 +73,7 @@ target_link_libraries(${target} PRIVATE Qt6::MockPlugins2) # Check that both regular and finalizer mode plugin importing pulls in the same set of plugins. # In regular mode, qt_finalize_target won't execute the finalizer plugin importing, because -# we opt out via qt_enable_import_plugins_finalizer_mode(target FALSE). +# we opt out via qt_set_finalizer_mode(target DISABLE MODES static_plugins). foreach(import_mode "" "FINALIZER_MODE") create_test_executable(manual QMock1Plugin QMock2Plugin QMock3Plugin QMock4Plugin ${import_mode}) diff --git a/tests/auto/cmake/test_static_resources/test_static_resources_propagation/CMakeLists.txt b/tests/auto/cmake/test_static_resources/test_static_resources_propagation/CMakeLists.txt index a219d6938d..44d4839084 100644 --- a/tests/auto/cmake/test_static_resources/test_static_resources_propagation/CMakeLists.txt +++ b/tests/auto/cmake/test_static_resources/test_static_resources_propagation/CMakeLists.txt @@ -1,3 +1,10 @@ +# TODO: Revisit which of these tests makes sense to keep now that we depend on CMake 3.21 to +# properly place object libraries object files on the link line. +# See QTBUG-95601 +# +# +# +# # Add a dummy library that links the static "Qt" module containing resources file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" CONTENT "void dummy() { }") add_library(dummy STATIC "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") @@ -77,24 +84,26 @@ if(NOT link_order_matters) COMMAND test_static_resources_propagation_non_ld ) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) - qt_add_executable(test_static_resources_propagation_not_finalize main.cpp) - qt6_enable_object_libraries_finalizer_mode( - test_static_resources_propagation_not_finalize FALSE - ) - set_target_properties(test_static_resources_propagation_not_finalize PROPERTIES - AUTOMOC TRUE - ) - target_link_libraries(test_static_resources_propagation_not_finalize - PRIVATE - dummy - Qt::Core - Qt::Test - ) - add_test(NAME test_static_resources_propagation_not_finalize - COMMAND test_static_resources_propagation_not_finalize - ) - endif() +# FIXME: qt6_enable_object_libraries_finalizer_mode is not available anymore. See QTBUG-95601 +# +# if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) +# qt_add_executable(test_static_resources_propagation_not_finalize main.cpp) +# qt6_enable_object_libraries_finalizer_mode( +# test_static_resources_propagation_not_finalize FALSE +# ) +# set_target_properties(test_static_resources_propagation_not_finalize PROPERTIES +# AUTOMOC TRUE +# ) +# target_link_libraries(test_static_resources_propagation_not_finalize +# PRIVATE +# dummy +# Qt::Core +# Qt::Test +# ) +# add_test(NAME test_static_resources_propagation_not_finalize +# COMMAND test_static_resources_propagation_not_finalize +# ) +# endif() endif() # Add the executable using add_executable, expecting resources are propagated using |