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
20qt_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
31immediately as part of the call (unless the \c{NO_IMPORT_SCAN} option was
32passed to \l{qt6_add_qml_module}{qt_add_qml_module()} when defining the QML
33module). 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
35or shared library that \c target represents. The search follows QML module
36imports recursively.
37
38Because the call to \c{qmlimportscanner} runs at configure time rather than
39generation or build time, \c{qt_import_qml_plugins()} only knows about the
40information recorded on the \c target (or other targets it links or imports)
41at the time \c{qt_import_qml_plugins()} is called. Any linking or import
42relationships added after this call will not be considered. Therefore, this
43command should be called as late as possible in the \c{target}'s directory
44scope so that all the linking and import relationships are known.
45
46If \c target was created using \l{qt6_add_executable}{qt_add_executable()},
47projects would not normally need to call \c{qt_import_qml_plugins()} directly.
48When 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
50the Qml library. By default, this finalization occurs at the end of the same
51directory scope in which the \c target was created. If the \c target was
52created using the standard CMake \c{add_executable()} command instead, the
53project needs to call \c{qt_import_qml_plugins()} itself.
54
55\sa Q_IMPORT_QML_PLUGIN
56
57*/