Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qt_import_plugins.qdoc
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qt-import-plugins.html
6\ingroup cmake-commands-qtcore
7
8\title qt_import_plugins
9\keyword qt6_import_plugins
10
11\summary {Specifies a custom set of plugins to import or exclude.}
12
13\include cmake-find-package-core.qdocinc
14
15\cmakecommandsince 5.14
16
17\section1 Synopsis
18
19\badcode
20qt_import_plugins(target
21 [INCLUDE plugin ...]
22 [EXCLUDE plugin ...]
23 [INCLUDE_BY_TYPE plugin_type plugin ...]
24 [EXCLUDE_BY_TYPE plugin_type]
25 [NO_DEFAULT]
26)
27\endcode
28
29\versionlessCMakeCommandsNote qt6_import_plugins()
30
31\section1 Description
32
33Specifies a custom set of plugins to import. The optional arguments:
34\c INCLUDE, \c EXCLUDE, \c INCLUDE_BY_TYPE, and \c EXCLUDE_BY_TYPE,
35can be used more than once.
36
37\list
38\li \c INCLUDE -- can be used to specify a list of plugins to import.
39\li \c EXCLUDE -- can be used to specify a list of plugins to exclude.
40\li \c INCLUDE_BY_TYPE -- can be used to override the list of plugins to
41 import for a certain plugin type.
42\li \c EXCLUDE_BY_TYPE -- can be used to specify a plugin type to exclude;
43 then no plugins of that type are imported.
44\li \c NO_DEFAULT -- prevent the default plugins from being included
45 automatically (for example, the default platform plugin).
46\endlist
47
48Qt provides plugin types such as \c imageformats, \c platforms,
49and \c sqldrivers.
50
51\section2 Dynamic plugins
52
53If plugins are dynamic libraries, the function controls the plugin deployment.
54Using this function, you may exclude specific plugin types from
55being packaged into an Android APK, for example:
56
57\badcode
58qt_add_executable(MyApp ...)
59...
60qt_import_plugins(MyApp EXCLUDE_BY_TYPE imageformats)
61\endcode
62
63In the snippet above, all plugins that have the \c imageformats type will
64be excluded when deploying \c MyApp. The resulting Android APK will not
65contain any of the \c imageformats plugins.
66
67If the command isn't used, the target automatically deploys all plugins that
68belong to the Qt modules that the target is linked against.
69
70\section2 Static plugins
71
72If the command isn't used the target automatically links against
73a sane set of default static plugins, for each Qt module that the target is
74linked against. For more information, see
75\l{CMake target_link_libraries Documentation}{target_link_libraries}.
76
77Each plugin comes with a C++ stub file that automatically
78initializes the static plugin. Consequently, any target that links against
79a plugin has this C++ file added to its \c SOURCES.
80
81\section1 Examples
82
83\snippet cmake-macros/examples.cmake qt_import_plugins
84
85In the snippet above, the following occurs with the executable \c myapp:
86
87\list
88\li The \c Qt6::QCocoaIntegrationPlugin is imported into myapp.
89\li The \c Qt6::QMinimalIntegrationPlugin plugin is
90 excluded from being automatically imported into myapp.
91\li The default list of plugins for \c imageformats is
92 overridden to only include Qt6::QGifPlugin and Qt6::QJpegPlugin.
93\li All \c sqldrivers plugins are excluded from automatic importing.
94\endlist
95
96\sa{qt6_import_qml_plugins}{qt_import_qml_plugins()}
97*/