summaryrefslogtreecommitdiffstats
path: root/cmake/QtPublicPluginHelpers.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-07-01 14:45:54 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-07-05 13:04:09 +0200
commit7d6f1ee5a75cae9d122a3f0c7b3a6d03f380535e (patch)
tree540d8c5467745acdb4a2f9e1f643163f47e6279f /cmake/QtPublicPluginHelpers.cmake
parentff4be4cf30ec470ab00290c629bb1bc311b77e22 (diff)
CMake: Create and include plugin packages in shared builds
Previously QtModulePlugins.cmake files were only created and included in static library Qt builds. Having the targets available in shared library builds would be useful for custom project deployment purposes. One could query the location of the plugins or use various generator expressions referencing their location. Ensure we always generate and include the QtModulePlugins.cmake files regardless of the build type. Allow opting out of including the files by setting QT_SKIP_AUTO_PLUGIN_INCLUSION to ON, just like we allow for Qml plugins with QT_SKIP_AUTO_QML_PLUGIN_INCLUSION. Pick-to: 6.4 Fixes: QTBUG-94066 Change-Id: I69a5dc17762a8e43265578fc33b82b5c4b7a1f5c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtPublicPluginHelpers.cmake')
-rw-r--r--cmake/QtPublicPluginHelpers.cmake9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmake/QtPublicPluginHelpers.cmake b/cmake/QtPublicPluginHelpers.cmake
index 90d784d88e..6dfaead755 100644
--- a/cmake/QtPublicPluginHelpers.cmake
+++ b/cmake/QtPublicPluginHelpers.cmake
@@ -461,9 +461,12 @@ function(__qt_internal_include_plugin_packages target)
list(APPEND "QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}" "${plugin_target}")
- __qt_internal_add_static_plugin_linkage("${plugin_target}" "${_module_target}")
- __qt_internal_add_static_plugin_import_macro(
- "${plugin_target}" ${_module_target} "${target}")
+ # Auto-linkage should be set up only for static library builds.
+ if(NOT QT6_IS_SHARED_LIBS_BUILD)
+ __qt_internal_add_static_plugin_linkage("${plugin_target}" "${_module_target}")
+ __qt_internal_add_static_plugin_import_macro(
+ "${plugin_target}" ${_module_target} "${target}")
+ endif()
endforeach()
set("QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}"