Qt 6.x
The Qt SDK
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 for a static Qt build.}
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
51If the command isn't used the target automatically links against
52a sane set of default plugins, for each Qt module that the target is linked
53against. For more information, see
54\l{CMake target_link_libraries Documentation}{target_link_libraries}.
55
56Each plugin comes with a C++ stub file that automatically
57initializes the plugin. Consequently, any target that links against a plugin
58has this C++ file added to its \c SOURCES.
59
60\note This command imports plugins from static Qt builds only.
61On shared builds, it does nothing.
62
63\section1 Examples
64
65\snippet cmake-macros/examples.cmake qt_import_plugins
66
67In the snippet above, the following occurs with the executable \c myapp:
68
69\list
70\li The \c Qt6::QCocoaIntegrationPlugin is imported into myapp.
71\li The \c Qt6::QMinimalIntegrationPlugin plugin is
72 excluded from being automatically imported into myapp.
73\li The default list of plugins for \c imageformats is
74 overridden to only include Qt6::QGifPlugin and Qt6::QJpegPlugin.
75\li All \c sqldrivers plugins are excluded from automatic importing.
76\endlist
77
78\sa{qt6_import_qml_plugins}{qt_import_qml_plugins()}
79*/