aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/src/cmake/qt_import_qml_plugins.qdoc
blob: b720d6d592a012b3550dc784c0d37350e36a7a77 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\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

*/