1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5\page qt-import-plugins.html
6\ingroup cmake-commands-qtcore
8\title qt_import_plugins
9\keyword qt6_import_plugins
11\summary {Specifies a custom set of plugins to import for a static Qt build.}
13\include cmake-find-package-core.qdocinc
15\cmakecommandsince 5.14
20qt_import_plugins(target
23 [INCLUDE_BY_TYPE plugin_type plugin ...]
24 [EXCLUDE_BY_TYPE plugin_type]
29\versionlessCMakeCommandsNote qt6_import_plugins()
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.
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).
48Qt provides plugin types such as \c imageformats, \c platforms,
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}.
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.
60\note This command imports plugins from static Qt builds only.
61On shared builds, it does nothing.
65\snippet cmake-macros/examples.cmake qt_import_plugins
67In the snippet above, the following occurs with the executable \c myapp:
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.
78\sa{qt6_import_qml_plugins}{qt_import_qml_plugins()}