diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-10 18:55:28 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-18 10:45:25 +0200 |
commit | aed94b820b21ba4adaee08796e9db21fce71f671 (patch) | |
tree | 1b7db3acc1be0e4991858ce4213fa86a90d948b5 /src/qml/Qt6QmlBuildInternals.cmake | |
parent | ac03b4b8ee9cc8d4522e0c8cf1018ff086f80c1b (diff) |
CMake: Adjust QML plugin class name auto-computing
The recent 602d26c38f3767be9bec25302c93fc155c4dce59 change in qtbase
is now requiring that CLASS_NAME is always set for qml plugins, to
ensure that in static builds we can pre-build a plugin initializer
object library.
Split out the uri escaping and class name generation code into
separate functions.
Ensure that the class name is auto-generated by
qt_internal_add_qml_plugin if it wasn't manually specified.
Pass that value to the qt_internal_add_plugin function.
Remove comment about not passing the CLASS_NAME.
Task-number: QTBUG-93257
Task-number: QTBUG-92933
Change-Id: I8aa482a7da3a59f5a2213a630ff0be70506efe11
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlBuildInternals.cmake')
-rw-r--r-- | src/qml/Qt6QmlBuildInternals.cmake | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/qml/Qt6QmlBuildInternals.cmake b/src/qml/Qt6QmlBuildInternals.cmake index 8bb69734aa..a9cc7ef3f7 100644 --- a/src/qml/Qt6QmlBuildInternals.cmake +++ b/src/qml/Qt6QmlBuildInternals.cmake @@ -27,12 +27,6 @@ function(qt_internal_add_qml_module target) module_multi_args ) - # We don't want to pass CLASS_NAME to qt_internal_add_plugin(), we will - # pass it to qt6_add_qml_module() to handle instead. qt_internal_add_plugin() - # would just ignore it anyway because we set TYPE to qml_plugin, but we have - # to remove it to prevent duplicates in argument parsing. - list(REMOVE_ITEM module_single_args CLASS_NAME) - set(qml_module_option_args DESIGNER_SUPPORTED NO_PLUGIN_OPTIONAL @@ -194,6 +188,14 @@ function(qt_internal_add_qml_module target) endif() if(NOT arg_NO_CREATE_PLUGIN_TARGET) + # If the qt_internal_add_qml_module call didn't specify a CLASS_NAME, we need to pre-compute + # it here and pass it along to qt_internal_add_plugin -> qt_add_plugin so that + # qt_add_qml_plugin does not complain about differing class names (the default pre-computed + # class name of a regular plugin and qml plugin are different). + if(NOT arg_CLASS_NAME) + _qt_internal_compute_qml_plugin_class_name_from_uri("${arg_URI}" arg_CLASS_NAME) + endif() + # Create plugin target now so we can set internal things list(APPEND plugin_args TYPE qml_plugin |