This command was introduced in Qt 6.0.
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.
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 (unless the NO_IMPORT_SCAN
option was passed to qt_add_qml_module() when defining the QML module). 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.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: