find_package(Qt5QmlImportScanner REQUIRED) qt5_import_qml_plugins(<TARGET>)
运行
qmlimportscanner
at configure time to find the static QML plugins used and links them to the given target.
注意: When used with a non-static Qt build, this function does nothing.
This CMake command was introduced in Qt 5.14.
find_package(Qt5 COMPONENTS Quick QmlImportScanner) add_executable(myapp main.cpp) target_link_libraries(myapp Qt5::Quick) qt5_import_qml_plugins(myapp)