aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/src/cmake/qt_import_qml_plugins.qdoc
blob: 8d6b32f903ccaa2ff1153e31be0d06bcb1e71ac6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
\page qt-import-qml-plugins.html
\ingroup cmake-commands-qtqml

\title qt_import_qml_plugins
\target qt6_import_qml_plugins

\brief Ensures QML plugins needed by a target are imported for static builds.

\cmakecommandsince 6.0

\section1 Synopsis

\badcode
qt_import_qml_plugins(target)
\endcode

\versionlessCMakeCommandsNote qt6_import_qml_plugins()

\section1 Description

\note This command only has any effect if Qt was built statically. If called
      using a non-static Qt, it will do nothing and return immediately.

\c{qt_import_qml_plugins()} runs \c{qmlimportscanner} on the \c target
immediately as part of the call (unless the \c{NO_IMPORT_SCAN} option was
passed to \l{qt6_add_qml_module}{qt_add_qml_module()} when defining the QML
module). It finds the static QML plugins used by the
\c target and links it to those plugins so that they are part of the executable
or shared library that \c target represents. The search follows QML module
imports recursively.

Because the call to \c{qmlimportscanner} runs at configure time rather than
generation or build time, \c{qt_import_qml_plugins()} only knows about the
information recorded on the \c target (or other targets it links or imports)
at the time \c{qt_import_qml_plugins()} is called. Any linking or import
relationships added after this call will not be considered. Therefore, this
command should be called as late as possible in the \c{target}'s directory
scope so that all the linking and import relationships are known.

If \c target was created using \l{qt6_add_executable}{qt_add_executable()},
projects would not normally need to call \c{qt_import_qml_plugins()} directly.
When Qt is built statically, the command is called automatically as part of
\l{qt6_add_executable#Finalization}{target finalization} if \c target links to
the Qml library. By default, this finalization occurs at the end of the same
directory scope in which the \c target was created. If the \c target was
created using the standard CMake \c{add_executable()} command instead, the
project needs to call \c{qt_import_qml_plugins()} itself.

\sa Q_IMPORT_QML_PLUGIN

*/