summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-05-26 17:19:08 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-05-27 14:28:17 +0200
commita3c430f390b379d874916d4c9ff02af5323af1bd (patch)
treeb8ef5ea06f35fe6543bd7a12f954cbbc3a5f74e2 /cmake
parenta1c8530a91b91715ce6fe007f7147ec349afc160 (diff)
CMake: Revise plugin finalizer mode usage
Only use plugin finalizer mode if qt_finalize_target is called at the end of the user project (which we can't really check, the user has to ensure that) or when qt_finalize_target is automatically defer-called by CMake 3.19+ (which is done by qt_add_executable). This removes the previous behavior of using the finalizer mode if qt_import_plugins is called. Instead the old regular mode is used if the above preconditions are not met. The removed behavior had ordering issues if qt_import_plugins was called before target_link_libraries. The dependency walking would be done before Qt dependencies were added and thus no plugins would be linked. Amends 6fcc272ac9dcf1d6d65de1bdf3138722ba63a902 Task-number: QTBUG-80863 Task-number: QTBUG-92933 Task-number: QTBUG-94030 Change-Id: I78702b653a35596f5581c2f4282b2336f0124e60 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtPublicPluginHelpers.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmake/QtPublicPluginHelpers.cmake b/cmake/QtPublicPluginHelpers.cmake
index 35026fa395..0c4eebec0b 100644
--- a/cmake/QtPublicPluginHelpers.cmake
+++ b/cmake/QtPublicPluginHelpers.cmake
@@ -365,6 +365,8 @@ function(__qt_internal_apply_plugin_imports_finalizer_mode target)
__qt_internal_get_plugin_imports_finalizer_mode(${target} use_finalizer_mode)
# By default if the project hasn't explicitly opted in or out, use finalizer mode.
+ # The precondition for this is that qt_finalize_target was called (either explicitly by the user
+ # or auto-deferred by CMake 3.19+).
if("${use_finalizer_mode}" STREQUAL "")
qt_enable_import_plugins_finalizer_mode(${target} TRUE)
endif()