Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
20
qt_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
33
Specifies a custom set of plugins to import. The optional arguments:
34
\c INCLUDE, \c EXCLUDE, \c INCLUDE_BY_TYPE, and \c EXCLUDE_BY_TYPE,
35
can 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
48
Qt provides plugin types such as \c imageformats, \c platforms,
49
and \c sqldrivers.
50
51
\section2 Dynamic plugins
52
53
If plugins are dynamic libraries, the function controls the plugin deployment.
54
Using this function, you may exclude specific plugin types from
55
being packaged into an Android APK, for example:
56
57
\badcode
58
qt_add_executable(MyApp ...)
59
...
60
qt_import_plugins(MyApp EXCLUDE_BY_TYPE imageformats)
61
\endcode
62
63
In the snippet above, all plugins that have the \c imageformats type will
64
be excluded when deploying \c MyApp. The resulting Android APK will not
65
contain any of the \c imageformats plugins.
66
67
If the command isn't used, the target automatically deploys all plugins that
68
belong to the Qt modules that the target is linked against.
69
70
\section2 Static plugins
71
72
If the command isn't used the target automatically links against
73
a sane set of default static plugins, for each Qt module that the target is
74
linked against. For more information, see
75
\l{CMake target_link_libraries Documentation}{target_link_libraries}.
76
77
Each plugin comes with a C++ stub file that automatically
78
initializes the static plugin. Consequently, any target that links against
79
a 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
85
In 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 \c Qt6::QGifPlugin and \c 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
*/
qtbase
src
corelib
doc
src
cmake
qt_import_plugins.qdoc
Generated on
for Qt by
1.14.0