diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-02-27 11:27:31 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-03-02 19:31:13 +0000 |
commit | 10a310c089e0d9731067abd6bb56771b51719043 (patch) | |
tree | 01f0fd4e94be9cf561f61c46abfb611b10c1caf0 /src/qml/Qt6QmlMacros.cmake | |
parent | 024794255d7d1df10fa5239cb70212c9703ff60f (diff) |
qt_add_qml_module: Error out if singleton is marked as internal
A singleton cannot be marked as internal – the qmldir parser cannot
even parse such a declaration, and the runtime would have no idea how to
deal with such a type.
The cmake code so far generated two entries – one line where the type is
a singleton, and the other one where the type is declared as internal –
with the end result that the type was not treated as a singleton, at
least not by qmllint.
Once the engine actually supports internal singletons, we would need to
adjust the qmldir file to have singleton and internal in one line.
As that's not supported so far, we now simply error out with a fatal
warning.
Task-number: QTBUG-111532
Pick-to: 6.5 6.4 6.2
Change-Id: Idf0843c5548b15f79700a45b4197c256a6dda5cd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlMacros.cmake')
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index b6899f8e00..0284d0e75f 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -2157,6 +2157,12 @@ function(qt6_target_qml_sources target) get_source_file_property(qml_file_singleton ${qml_file_src} QT_QML_SINGLETON_TYPE) get_source_file_property(qml_file_internal ${qml_file_src} QT_QML_INTERNAL_TYPE) + if (qml_file_singleton AND qml_file_internal) + message(FATAL_ERROR + "${qml_file_src} is marked as both internal and as a " + "singleton, but singletons cannot be internal!") + endif() + if (NOT qml_file_versions) set(qml_file_versions ${qml_module_files_versions}) endif() |