From 8cdbcee614dbb34d4ac770bee1734c18ea27fa12 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 30 Oct 2020 11:27:36 +0100 Subject: CMake: Allow building pure QML modules not backed by C++ sources When no C++ sources are passed to qt_internal_add_qml_plugin (a pure QML module), create a C++ backed Qt plugin anyway. In such a case, generate a dummy plugin.cpp containing a QQmlEngineExtensionPlugin subclass. The class name is autogenerated from the QML import URI. The class constructor will call the qmltyperegistrar generated void qml_register_types_foo() function, to ensure the needed module versions are registered for the QML module. Change-Id: I19959dafdf0dc837c6037e7dc1d549b7420110a7 Reviewed-by: Fabian Kosmale --- src/qml/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/qml/CMakeLists.txt') diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt index 68e5a94734..596a8fdfc0 100644 --- a/src/qml/CMakeLists.txt +++ b/src/qml/CMakeLists.txt @@ -668,4 +668,10 @@ qt_copy_or_install(FILES "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ImportScannerTemplate.cpp.in" DESTINATION "${config_install_dir}" ) + +# Install pure QML Plugin template cpp file. +qt_copy_or_install(FILES + "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}PluginTemplate.cpp.in" + DESTINATION "${config_install_dir}" +) # special case end -- cgit v1.2.3