W3cubDocs

/Qt

qt_import_qml_plugins

Synopsis

qt_import_qml_plugins(target)

If versionless commands are disabled, use qt6_import_qml_plugins() instead. It supports the same set of arguments as this command.

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.

qt_import_qml_plugins() runs qmlimportscanner on the target immediately as part of the call. It finds the static QML plugins used by the target and links it to those plugins so that they are part of the executable or shared library that target represents. The search follows QML module imports recursively.

Because the call to qmlimportscanner runs at configure time rather than generation or build time, qt_import_qml_plugins() only knows about the information recorded on the target (or other targets it links or imports) at the time 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 target's directory scope so that all the linking and import relationships are known.

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

See also Q_IMPORT_QML_PLUGIN.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qt-import-qml-plugins.html