qt_import_qml_plugins

该命令在 Qt 6.0 引入。

概要

qt_import_qml_plugins(target)
					

无版本命令 被禁用,使用 qt6_import_qml_plugins() 代替。它支持如此命令的一组相同自变量。

描述

注意: 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 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.

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() 本身。

另请参阅 Q_IMPORT_QML_PLUGIN .