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_qml_plugins.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qt-import-qml-plugins.html
6
\ingroup cmake-commands-qtqml
7
8
\title qt_import_qml_plugins
9
\keyword qt6_import_qml_plugins
10
11
\brief Ensures QML plugins needed by a target are imported for static builds.
12
13
\cmakecommandsince 6.0
14
15
\include cmake-find-package-qml.qdocinc
16
17
\section1 Synopsis
18
19
\badcode
20
qt_import_qml_plugins(target)
21
\endcode
22
23
\versionlessCMakeCommandsNote qt6_import_qml_plugins()
24
25
\section1 Description
26
27
\note This command only has any effect if Qt was built statically. If called
28
using a non-static Qt, it will do nothing and return immediately.
29
30
\c{qt_import_qml_plugins()} runs \c{qmlimportscanner} on the \c target
31
immediately as part of the call (unless the \c{NO_IMPORT_SCAN} option was
32
passed to \l{qt6_add_qml_module}{qt_add_qml_module()} when defining the QML
33
module). It finds the static QML plugins used by the
34
\c target and links it to those plugins so that they are part of the executable
35
or shared library that \c target represents. The search follows QML module
36
imports recursively.
37
38
Because the call to \c{qmlimportscanner} runs at configure time rather than
39
generation or build time, \c{qt_import_qml_plugins()} only knows about the
40
information recorded on the \c target (or other targets it links or imports)
41
at the time \c{qt_import_qml_plugins()} is called. Any linking or import
42
relationships added after this call will not be considered. Therefore, this
43
command should be called as late as possible in the \c{target}'s directory
44
scope so that all the linking and import relationships are known.
45
46
If \c target was created using \l{qt6_add_executable}{qt_add_executable()},
47
projects would not normally need to call \c{qt_import_qml_plugins()} directly.
48
When Qt is built statically, the command is called automatically as part of
49
\l{qt6_add_executable#Finalization}{target finalization} if \c target links to
50
the Qml library. By default, this finalization occurs at the end of the same
51
directory scope in which the \c target was created. If the \c target was
52
created using the standard CMake \c{add_executable()} command instead, the
53
project needs to call \c{qt_import_qml_plugins()} itself.
54
55
\sa Q_IMPORT_QML_PLUGIN
56
57
*/
qtdeclarative
src
qml
doc
src
cmake
qt_import_qml_plugins.qdoc
Generated on
for Qt by
1.14.0