diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-05-26 17:19:08 +0200 |
|---|---|---|
| committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-05-27 14:28:17 +0200 |
| commit | a3c430f390b379d874916d4c9ff02af5323af1bd (patch) | |
| tree | b8ef5ea06f35fe6543bd7a12f954cbbc3a5f74e2 /src | |
| parent | a1c8530a91b91715ce6fe007f7147ec349afc160 (diff) | |
| download | qtbase-a3c430f390b379d874916d4c9ff02af5323af1bd.tar.gz | |
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 'src')
| -rw-r--r-- | src/corelib/Qt6CoreMacros.cmake | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 6cba48dee7..6dca713ee6 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -591,8 +591,8 @@ function(_qt_internal_finalize_executable target) # For finalizer mode of plugin importing to work safely, we need to know the list of Qt # dependencies the target has, but those might be added later than the qt_add_executable call. # Most of our examples are like that. Only enable finalizer mode when we are sure that the user - # manually finalized the executable, or it was automatically done via a deferred call. - # A project can still do it manually by calling qt_import_plugins() explicitly. + # manually called qt_finalize_target at the end of their CMake project, or it was automatically + # done via a deferred call. get_target_property(is_immediately_finalized "${target}" _qt_is_immediately_finalized) if(NOT is_immediately_finalized) __qt_internal_apply_plugin_imports_finalizer_mode("${target}") @@ -868,15 +868,6 @@ function(qt6_import_plugins target) string(REGEX REPLACE "[-/]" "_" _plugin_type "${_arg}") set_property(TARGET "${target}" PROPERTY "QT_PLUGINS_${_plugin_type}" "-") endforeach() - - # If the project called qt_import_plugins, use this as an event to enable finalizer mode for - # plugin importing. - # - # This is done in addition to the code in qt_finalize_target, to ensure pre-existing - # projects that use qt_import_plugins activate finalizer mode even with an older CMake version - # that doesn't support deferred calls (and projects that don't explicitly call - # qt_finalize_target). - __qt_internal_apply_plugin_imports_finalizer_mode(${target}) endfunction() if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) @@ -901,8 +892,7 @@ endif() # of its associated module. # # Finalizer mode is enabled by default if: -# - the project calls qt_import_plugins explicitly or -# - the project calls qt_finalize_target explicitly or +# - the project calls qt_finalize_target explicitly at the end of the project file or # - the project uses qt_add_executable and a CMake version greater than or equal to 3.19 # (which will DEFER CALL qt_finalize_target) function(qt6_enable_import_plugins_finalizer_mode target enabled) |
