From b714219fea567ff4ad7d84972704dbed8f5b4cf3 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 22 Jan 2020 16:28:57 +0100 Subject: Fix qt_import_plugins compatibility with Qt 5 Handle versionless plugin names passed to qt_import_plugins. Task-number: QTBUG-74137 Task-number: QTBUG-80477 Change-Id: Ic7fb6e54d2822c7eb58a7874b4a1c137f0c101d9 Reviewed-by: Qt CMake Build Bot Reviewed-by: Cristian Adam --- cmake/QtPlugins.cmake.in | 19 ++++++++++++++++++- src/corelib/Qt6CoreMacros.cmake | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/cmake/QtPlugins.cmake.in b/cmake/QtPlugins.cmake.in index 5e2352d6c1..91884302c6 100644 --- a/cmake/QtPlugins.cmake.in +++ b/cmake/QtPlugins.cmake.in @@ -34,6 +34,7 @@ if(NOT @BUILD_SHARED_LIBS@) # The code in here uses the properties defined in qt_import_plugins (Qt6CoreMacros.cmake) foreach(target @qt_plugins@) set(_plugin_target "@INSTALL_CMAKE_NAMESPACE@::${target}") + set(_plugin_target_versionless "Qt::${target}") get_target_property(_classname "${_plugin_target}" QT_PLUGIN_CLASS_NAME) if(NOT _classname) message("Warning: plugin ${_plugin_target} has no class name, skipping.") @@ -52,6 +53,8 @@ if(NOT @BUILD_SHARED_LIBS@) # INCLUDE set(_plugin_is_whitelisted "$") + set(_plugin_versionless_is_whitelisted + "$") # Note: qt_import_plugins sets the QT_PLUGINS_${_plugin_type} to "-" # when excluding it with EXCLUDE_BY_TYPE, @@ -61,7 +64,11 @@ if(NOT @BUILD_SHARED_LIBS@) "$" ">," - # excludes both plugins targeted by EXCLUDE_BY_TYPE and not included in INCLUDE_BY_TYPE + "$" + ">," + # Excludes both plugins targeted by EXCLUDE_BY_TYPE and not included in + # INCLUDE_BY_TYPE. "$>>" ">" ) @@ -75,6 +82,14 @@ if(NOT @BUILD_SHARED_LIBS@) ">" ">" ) + string(CONCAT _plugin_versionless_is_in_type_whitelist + "$" + ">" + ">" + ) # Complete condition that defines whether a static plugin is linked string(CONCAT _plugin_condition @@ -82,7 +97,9 @@ if(NOT @BUILD_SHARED_LIBS@) "${_build_allow_plugin_link_rules_genex}," "$