CMake Wizards: Add Qt 6 specific static qml plugin importing

For Qml / Qt Quick projects to work with static Qt builds, the
application targets need to link to the static Qml plugins, which
is done by calling qt_import_qml_plugins.

Starting with Qt 6.1 and CMake 3.18+ that will be done automatically in
qt_add_application via qt_finalize_executable, as per
c71c48f5125c116f01f615f51f10e4f2877b2b1d

But for Qt 6.0 and lower CMake versions, we need to call
qt_import_qml_plugins manually, thus we include it in the
Qt Quick wizard template so that it works with all Qt 6 versions
and lower CMake versions.

Amends b72c1d11e6.

Task-number: QTCREATORBUG-23574
Change-Id: Id8db3352ecbb8441eda9f5c9638c7ea6ac1fee96
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alexandru Croitor
2021-03-11 10:05:55 +01:00
parent 5fbef6c060
commit af184fdd4c

View File

@@ -76,3 +76,7 @@ set_target_properties(%{ProjectName} PROPERTIES
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
) )
if(QT_VERSION_MAJOR EQUAL 6)
qt_import_qml_plugins(%{ProjectName})
endif()