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>
This commit is contained in:
parent
ff4be4cf30
commit
7d6f1ee5a7
@ -1,6 +1,6 @@
|
||||
include_guard(DIRECTORY)
|
||||
@QT_MODULE_PLUGIN_INCLUDES@
|
||||
|
||||
if(NOT @BUILD_SHARED_LIBS@ AND NOT QT_NO_CREATE_TARGETS)
|
||||
if(NOT QT_NO_CREATE_TARGETS AND NOT QT_SKIP_AUTO_PLUGIN_INCLUSION)
|
||||
__qt_internal_include_plugin_packages(@QT_MODULE@)
|
||||
endif()
|
||||
|
@ -2,7 +2,7 @@ include(QtPostProcessHelpers)
|
||||
|
||||
qt_internal_create_depends_files()
|
||||
qt_generate_build_internals_extra_cmake_code()
|
||||
qt_internal_create_plugins_files()
|
||||
qt_internal_create_plugins_auto_inclusion_files()
|
||||
qt_internal_create_config_file_for_standalone_tests()
|
||||
|
||||
# Needs to run after qt_internal_create_depends_files.
|
||||
|
@ -401,14 +401,11 @@ function(qt_internal_create_depends_files)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# This function creates the Qt<Module>Plugins.cmake used to list all
|
||||
# the plug-in target files.
|
||||
function(qt_internal_create_plugins_files)
|
||||
# The plugins cmake configuration is only needed for static builds. Dynamic builds don't need
|
||||
# the application to link against plugins at build time.
|
||||
if(QT_BUILD_SHARED_LIBS)
|
||||
return()
|
||||
endif()
|
||||
# This function creates Qt<Module>Plugins.cmake files used to include all
|
||||
# the plugin Config files that belong to that module.
|
||||
function(qt_internal_create_plugins_auto_inclusion_files)
|
||||
# For static library builds, the plugin targets need to be available for linking.
|
||||
# For shared library builds, the plugin targets are useful for deployment purposes.
|
||||
qt_internal_get_qt_repo_known_modules(repo_known_modules)
|
||||
|
||||
set(modules_with_plugins "")
|
||||
|
@ -461,9 +461,12 @@ function(__qt_internal_include_plugin_packages target)
|
||||
|
||||
list(APPEND "QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}" "${plugin_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}"
|
||||
|
Loading…
Reference in New Issue
Block a user