From 139961fc510fc9d26cb2545e54a3f4a3eeb87149 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 6 Aug 2020 14:56:51 +0200 Subject: CMake: Partially fix static qtdeclarative builds when using qmake Mimics e1e2b2d8ca89bbd90afe3e884e95bc7372bd22d5 in qtbase. Moc needs to be passed the URI as an argument, so that QQmlImportsPrivate::populatePluginPairVector doesn't fail finding the statically compiled QtQuick plugin. Fixes the following error static plugin for module "QtQuick" with name "QtQuick2Plugin" has no metadata URI import QtQuick 2.0 ^ This doesn't completely fix static qtdeclarative builds though. Task-number: QTBUG-85865 Change-Id: I1b43c3cd97b35c7222e05ecf6dcbaa16050f920f Reviewed-by: Fabian Kosmale --- src/qml/Qt6QmlMacros.cmake | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 5d81fd7be6..24a5eb533b 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -225,6 +225,10 @@ function(qt6_add_qml_module target) target_sources(${target} PRIVATE ${arg_SOURCES}) endif() + # Insert the plugins URI into its meta data to enable usage + # of static plugins in QtDeclarative (like in mkspecs/features/qml_plugin.prf). + set_property(TARGET "${target}" APPEND PROPERTY AUTOMOC_MOC_OPTIONS "-Muri=${arg_URI}") + # Tracker so we can generate unique resource names for multiple # target_qml_files() calls. set_target_properties(${target} PROPERTIES QT6_QML_MODULE_ADD_QML_FILES_COUNT 1) -- cgit v1.2.3