From 7700d8cb6117f51faede95134e6270017f282ecb Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 15 Jan 2024 08:14:29 +0100 Subject: [PATCH] Document qt_import_plugins behavior for dynamic plugins This describes how qt_import_plugins works for dynamic plugins. Pick-to: 6.6 6.5 Task-number: QTBUG-118829 Change-Id: I7b30060c11c0d8c4a1fbae6782a047737ba7d454 Reviewed-by: Leena Miettinen Reviewed-by: Assam Boudjelthia (cherry picked from commit 2e328ca5a8242b0c3edec8e59d1cfa02d4596202) Reviewed-by: Qt Cherry-pick Bot --- .../doc/src/cmake/qt_import_plugins.qdoc | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/corelib/doc/src/cmake/qt_import_plugins.qdoc b/src/corelib/doc/src/cmake/qt_import_plugins.qdoc index 4b612206ee2..1f81a21cd2d 100644 --- a/src/corelib/doc/src/cmake/qt_import_plugins.qdoc +++ b/src/corelib/doc/src/cmake/qt_import_plugins.qdoc @@ -8,7 +8,7 @@ \title qt_import_plugins \keyword qt6_import_plugins -\summary {Specifies a custom set of plugins to import for a static Qt build.} +\summary {Specifies a custom set of plugins to import or exclude.} \include cmake-find-package-core.qdocinc @@ -48,17 +48,35 @@ can be used more than once. Qt provides plugin types such as \c imageformats, \c platforms, and \c sqldrivers. +\section2 Dynamic plugins + +If plugins are dynamic libraries, the function controls the plugin deployment. +Using this function, you may exclude specific plugin types from +being packaged into an Android APK, for example: + +\badcode +qt_add_executable(MyApp ...) +... +qt_import_plugins(MyApp EXCLUDE_BY_TYPE imageformats) +\endcode + +In the snippet above, all plugins that have the \c imageformats type will +be excluded when deploying \c MyApp. The resulting Android APK will not +contain any of the \c imageformats plugins. + +If the command isn't used, the target automatically deploys all plugins that +belong to the Qt modules that the target is linked against. + +\section2 Static plugins + If the command isn't used the target automatically links against -a sane set of default plugins, for each Qt module that the target is linked -against. For more information, see +a sane set of default static plugins, for each Qt module that the target is +linked against. For more information, see \l{CMake target_link_libraries Documentation}{target_link_libraries}. Each plugin comes with a C++ stub file that automatically -initializes the plugin. Consequently, any target that links against a plugin -has this C++ file added to its \c SOURCES. - -\note This command imports plugins from static Qt builds only. -On shared builds, it does nothing. +initializes the static plugin. Consequently, any target that links against +a plugin has this C++ file added to its \c SOURCES. \section1 Examples