aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-03-03 23:17:17 +1100
committerCraig Scott <craig.scott@qt.io>2021-03-31 21:40:49 +1100
commit3d09e9c2f521c638a312378e3c7f137accfe8212 (patch)
tree9a33804b8f9f8568dff98e2614a4ac83b77eb7b0 /src
parent661f120c1d9e00aff31c432f84f83f58b8aa9c9a (diff)
Use CLASS_NAME rather than CLASSNAME for qt6_add_qml_module()
Task-number: QTBUG-88763 Change-Id: I118227ec418ac59eb6603d236b38b1a4319a51c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/folderlistmodel/CMakeLists.txt2
-rw-r--r--src/imports/labsanimation/CMakeLists.txt2
-rw-r--r--src/imports/labsmodels/CMakeLists.txt2
-rw-r--r--src/imports/layouts/CMakeLists.txt2
-rw-r--r--src/imports/localstorage/CMakeLists.txt2
-rw-r--r--src/imports/models/CMakeLists.txt2
-rw-r--r--src/imports/particles/CMakeLists.txt2
-rw-r--r--src/imports/qtqml/CMakeLists.txt2
-rw-r--r--src/imports/qtquick2/CMakeLists.txt2
-rw-r--r--src/imports/settings/CMakeLists.txt2
-rw-r--r--src/imports/shapes/CMakeLists.txt2
-rw-r--r--src/imports/sharedimage/CMakeLists.txt2
-rw-r--r--src/imports/testlib/CMakeLists.txt2
-rw-r--r--src/imports/wavefrontmesh/CMakeLists.txt2
-rw-r--r--src/imports/workerscript/CMakeLists.txt2
-rw-r--r--src/imports/xmllistmodel/CMakeLists.txt2
-rw-r--r--src/qml/Qt6QmlBuildInternals.cmake17
-rw-r--r--src/qml/Qt6QmlMacros.cmake51
18 files changed, 63 insertions, 37 deletions
diff --git a/src/imports/folderlistmodel/CMakeLists.txt b/src/imports/folderlistmodel/CMakeLists.txt
index 85a43061f4..a40c33bea3 100644
--- a/src/imports/folderlistmodel/CMakeLists.txt
+++ b/src/imports/folderlistmodel/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(qmlfolderlistmodelplugin
URI "Qt.labs.folderlistmodel"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QmlFolderListModelPlugin
+ CLASS_NAME QmlFolderListModelPlugin
SKIP_TYPE_REGISTRATION
PLUGIN_OPTIONAL
SOURCES
diff --git a/src/imports/labsanimation/CMakeLists.txt b/src/imports/labsanimation/CMakeLists.txt
index cdf50468ac..bd8d6b1e79 100644
--- a/src/imports/labsanimation/CMakeLists.txt
+++ b/src/imports/labsanimation/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(labsanimationplugin
URI "Qt.labs.animation"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QtLabsAnimationPlugin
+ CLASS_NAME QtLabsAnimationPlugin
SKIP_TYPE_REGISTRATION
PLUGIN_OPTIONAL
SOURCES
diff --git a/src/imports/labsmodels/CMakeLists.txt b/src/imports/labsmodels/CMakeLists.txt
index 0c59a15a20..c54ae32f1f 100644
--- a/src/imports/labsmodels/CMakeLists.txt
+++ b/src/imports/labsmodels/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(labsmodelsplugin
URI "Qt.labs.qmlmodels"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QtQmlLabsModelsPlugin
+ CLASS_NAME QtQmlLabsModelsPlugin
SKIP_TYPE_REGISTRATION
PLUGIN_OPTIONAL
SOURCES
diff --git a/src/imports/layouts/CMakeLists.txt b/src/imports/layouts/CMakeLists.txt
index 6cfb911ba9..f912f2db0b 100644
--- a/src/imports/layouts/CMakeLists.txt
+++ b/src/imports/layouts/CMakeLists.txt
@@ -9,7 +9,7 @@ qt_internal_add_qml_module(qquicklayoutsplugin
URI "QtQuick.Layouts"
VERSION "${CMAKE_PROJECT_VERSION}"
DESIGNER_SUPPORTED
- CLASSNAME QtQuickLayoutsPlugin
+ CLASS_NAME QtQuickLayoutsPlugin
SKIP_TYPE_REGISTRATION
DEPENDENCIES
QtQuick
diff --git a/src/imports/localstorage/CMakeLists.txt b/src/imports/localstorage/CMakeLists.txt
index 9d7cd13fe0..90c66d977f 100644
--- a/src/imports/localstorage/CMakeLists.txt
+++ b/src/imports/localstorage/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(qmllocalstorageplugin
URI "QtQuick.LocalStorage"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QQmlLocalStoragePlugin
+ CLASS_NAME QQmlLocalStoragePlugin
SKIP_TYPE_REGISTRATION
PLUGIN_OPTIONAL
SOURCES
diff --git a/src/imports/models/CMakeLists.txt b/src/imports/models/CMakeLists.txt
index 4070ad365b..1c59a0830d 100644
--- a/src/imports/models/CMakeLists.txt
+++ b/src/imports/models/CMakeLists.txt
@@ -8,7 +8,7 @@ qt_internal_add_qml_module(modelsplugin
URI "QtQml.Models"
VERSION "${CMAKE_PROJECT_VERSION}"
DESIGNER_SUPPORTED
- CLASSNAME QtQmlModelsPlugin
+ CLASS_NAME QtQmlModelsPlugin
SKIP_TYPE_REGISTRATION
PLUGIN_OPTIONAL
SOURCES
diff --git a/src/imports/particles/CMakeLists.txt b/src/imports/particles/CMakeLists.txt
index 7ecdc70544..429f84158a 100644
--- a/src/imports/particles/CMakeLists.txt
+++ b/src/imports/particles/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(particlesplugin
URI "QtQuick.Particles"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QtQuick2ParticlesPlugin
+ CLASS_NAME QtQuick2ParticlesPlugin
SKIP_TYPE_REGISTRATION
PLUGIN_OPTIONAL
SOURCES
diff --git a/src/imports/qtqml/CMakeLists.txt b/src/imports/qtqml/CMakeLists.txt
index 15e66fd53e..f4586b988d 100644
--- a/src/imports/qtqml/CMakeLists.txt
+++ b/src/imports/qtqml/CMakeLists.txt
@@ -18,7 +18,7 @@ qt_internal_add_qml_module(qmlplugin
URI "QtQml"
VERSION "${CMAKE_PROJECT_VERSION}"
DESIGNER_SUPPORTED
- CLASSNAME QtQmlPlugin
+ CLASS_NAME QtQmlPlugin
SKIP_TYPE_REGISTRATION
IMPORTS ${module_dynamic_qml_imports}
PLUGIN_OPTIONAL
diff --git a/src/imports/qtquick2/CMakeLists.txt b/src/imports/qtquick2/CMakeLists.txt
index e7e29bf9ae..40ea4a85c4 100644
--- a/src/imports/qtquick2/CMakeLists.txt
+++ b/src/imports/qtquick2/CMakeLists.txt
@@ -8,7 +8,7 @@ qt_internal_add_qml_module(qtquick2plugin
URI "QtQuick"
VERSION "${CMAKE_PROJECT_VERSION}"
DESIGNER_SUPPORTED
- CLASSNAME QtQuick2Plugin
+ CLASS_NAME QtQuick2Plugin
SKIP_TYPE_REGISTRATION
IMPORTS
QtQml/auto
diff --git a/src/imports/settings/CMakeLists.txt b/src/imports/settings/CMakeLists.txt
index f49e741106..9f00e79a36 100644
--- a/src/imports/settings/CMakeLists.txt
+++ b/src/imports/settings/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(qmlsettingsplugin
URI "Qt.labs.settings"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QmlSettingsPlugin
+ CLASS_NAME QmlSettingsPlugin
SKIP_TYPE_REGISTRATION
PLUGIN_OPTIONAL
SOURCES
diff --git a/src/imports/shapes/CMakeLists.txt b/src/imports/shapes/CMakeLists.txt
index fa1eb9297c..99c907cbcc 100644
--- a/src/imports/shapes/CMakeLists.txt
+++ b/src/imports/shapes/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(qmlshapesplugin
URI "QtQuick.Shapes"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QmlShapesPlugin
+ CLASS_NAME QmlShapesPlugin
SKIP_TYPE_REGISTRATION
DEPENDENCIES
QtQuick
diff --git a/src/imports/sharedimage/CMakeLists.txt b/src/imports/sharedimage/CMakeLists.txt
index b0faea295f..62a3fb4983 100644
--- a/src/imports/sharedimage/CMakeLists.txt
+++ b/src/imports/sharedimage/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(sharedimageplugin
URI "Qt.labs.sharedimage"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QtQuickSharedImagePlugin
+ CLASS_NAME QtQuickSharedImagePlugin
SKIP_TYPE_REGISTRATION
SOURCES
plugin.cpp
diff --git a/src/imports/testlib/CMakeLists.txt b/src/imports/testlib/CMakeLists.txt
index e94d1edc76..593b8c772c 100644
--- a/src/imports/testlib/CMakeLists.txt
+++ b/src/imports/testlib/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(qmltestplugin
URI "QtTest"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QTestQmlModule
+ CLASS_NAME QTestQmlModule
DEPENDENCIES
QtQuick.Window/2.0
SOURCES
diff --git a/src/imports/wavefrontmesh/CMakeLists.txt b/src/imports/wavefrontmesh/CMakeLists.txt
index 7dd97c8056..0202f2b08a 100644
--- a/src/imports/wavefrontmesh/CMakeLists.txt
+++ b/src/imports/wavefrontmesh/CMakeLists.txt
@@ -7,7 +7,7 @@
qt_internal_add_qml_module(qmlwavefrontmeshplugin
URI "Qt.labs.wavefrontmesh"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QmlWavefrontMeshPlugin
+ CLASS_NAME QmlWavefrontMeshPlugin
SKIP_TYPE_REGISTRATION
SOURCES
plugin.cpp
diff --git a/src/imports/workerscript/CMakeLists.txt b/src/imports/workerscript/CMakeLists.txt
index b2a6d0f444..39a48e6a05 100644
--- a/src/imports/workerscript/CMakeLists.txt
+++ b/src/imports/workerscript/CMakeLists.txt
@@ -8,7 +8,7 @@ qt_internal_add_qml_module(workerscriptplugin
URI "QtQml.WorkerScript"
VERSION "${CMAKE_PROJECT_VERSION}"
DESIGNER_SUPPORTED
- CLASSNAME QtQmlWorkerScriptPlugin
+ CLASS_NAME QtQmlWorkerScriptPlugin
SKIP_TYPE_REGISTRATION
PLUGIN_OPTIONAL
SOURCES
diff --git a/src/imports/xmllistmodel/CMakeLists.txt b/src/imports/xmllistmodel/CMakeLists.txt
index 387b588e84..84b7234c17 100644
--- a/src/imports/xmllistmodel/CMakeLists.txt
+++ b/src/imports/xmllistmodel/CMakeLists.txt
@@ -1,7 +1,7 @@
qt_internal_add_qml_module(qmlxmllistmodelplugin
URI "QtQml.XmlListModel"
VERSION "${CMAKE_PROJECT_VERSION}"
- CLASSNAME QtQmlXmlListModelPlugin
+ CLASS_NAME QtQmlXmlListModelPlugin
SKIP_TYPE_REGISTRATION
DEPENDENCIES
QtQml
diff --git a/src/qml/Qt6QmlBuildInternals.cmake b/src/qml/Qt6QmlBuildInternals.cmake
index 47ed053602..ef2c1c4ac6 100644
--- a/src/qml/Qt6QmlBuildInternals.cmake
+++ b/src/qml/Qt6QmlBuildInternals.cmake
@@ -31,6 +31,12 @@ function(qt_internal_add_qml_module target)
internal_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 public_single_args CLASS_NAME)
+
set(qml_module_option_args
GENERATE_QMLTYPES
INSTALL_QMLTYPES
@@ -43,8 +49,10 @@ function(qt_internal_add_qml_module target)
URI
TARGET_PATH
VERSION
- CLASSNAME
TYPEINFO
+ CLASS_NAME
+ CLASSNAME # TODO: Remove once all other repos have been updated to use
+ # CLASS_NAME instead.
)
set(qml_module_multi_args
@@ -123,11 +131,8 @@ function(qt_internal_add_qml_module target)
endif()
endforeach()
- # Pass through single and multi-value args as provided. CLASSNAME is
- # special because it can be passed to qt_internal_add_plugin() and
- # qt6_add_qml_module().
- foreach(arg IN LISTS qml_module_single_args qml_module_multi_args
- ITEMS CLASSNAME)
+ # Pass through single and multi-value args as provided
+ foreach(arg IN LISTS qml_module_single_args qml_module_multi_args)
if(DEFINED arg_${arg})
list(APPEND add_qml_module_args ${arg} ${arg_${arg}})
endif()
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index ae0d4570f1..501d76bfe5 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -42,7 +42,7 @@ set(__qt_qml_macros_module_base_dir "${CMAKE_CURRENT_LIST_DIR}")
# QML_FILES: List of Qml files. See qt6_target_qml_files for more information
# on how to specify additional properties on qml files. (OPTIONAL)
#
-# CLASSNAME: Provides the class name of the C++ plugin used by the module. This
+# CLASS_NAME: Provides the class name of the C++ plugin used by the module. This
# information is required for all the QML modules that depend on a C++ plugin
# for additional functionality. Qt Quick applications built with static
# linking cannot resolve the module imports without this information.
@@ -107,7 +107,8 @@ function(qt6_add_qml_module target)
VERSION
OUTPUT_DIRECTORY
INSTALL_DIRECTORY
- CLASSNAME
+ CLASS_NAME
+ CLASSNAME # For backward compatibility, remove once all repos no longer use it
TYPEINFO
RESOURCE_EXPORT
)
@@ -145,15 +146,16 @@ function(qt6_add_qml_module target)
message(FATAL_ERROR "qt6_add_qml_module called with an invalid version argument: '${arg_VERSION}'. Expected version style: VersionMajor.VersionMinor.")
endif()
- # If C++ sources were directly specified (not via qt_internal_add_qml_module), we assume the
- # user will provide a plugin.cpp file. Don't generate a dummy plugin.cpp file in this case.
- #
- # If no sources were specified or the plugin was marked as a pure QML module, generate a
- # dummy plugin.cpp file.
- if (arg_SOURCES OR NOT arg_PURE_MODULE)
- set(create_pure_qml_module_plugin FALSE)
- else()
- set(create_pure_qml_module_plugin TRUE)
+ # Support for old keyword, remove once all repos no longer use CLASSNAME
+ if(arg_CLASSNAME)
+ if(arg_CLASS_NAME AND NOT arg_CLASSNAME STREQUAL arg_CLASS_NAME)
+ message(FATAL_ERROR
+ "Both CLASSNAME and CLASS_NAME were given and were different. "
+ "Update call site to only use CLASS_NAME."
+ )
+ endif()
+ set(arg_CLASS_NAME "${arg_CLASSNAME}")
+ unset(arg_CLASSNAME)
endif()
if (arg_DO_NOT_CREATE_TARGET AND NOT TARGET "${target}")
@@ -199,8 +201,25 @@ function(qt6_add_qml_module target)
string(REPLACE "." "/" arg_TARGET_PATH ${arg_URI})
endif()
- if(create_pure_qml_module_plugin)
- _qt_internal_create_dummy_qml_plugin("${target}" "${arg_URI}" arg_CLASSNAME)
+ # If C++ sources were directly specified (not via qt_internal_add_qml_module), we assume the
+ # user will provide a plugin.cpp file. Don't generate a dummy plugin.cpp file in this case.
+ #
+ # If no sources were specified, it doesn't necessarily mean this is a pure QML module.
+ # Only if the caller explicitly says it is a pure QML module should we generate a
+ # dummy plugin.cpp file (the caller might be handling sources in another way).
+ if (arg_PURE_MODULE)
+ if (arg_SOURCES)
+ message(FATAL_ERROR "SOURCES cannot be specified with PURE_MODULE")
+ endif()
+ if(arg_CLASS_NAME)
+ message(FATAL_ERROR
+ "CLASS_NAME cannot be specified with PURE_MODULE. "
+ "The class name will be auto-generated."
+ )
+ endif()
+ # Note that this populates arg_CLASS_NAME, since it creates a dummy
+ # class name to match the dummy plugin
+ _qt_internal_create_dummy_qml_plugin("${target}" "${arg_URI}" arg_CLASS_NAME)
endif()
if (ANDROID)
@@ -297,8 +316,8 @@ function(qt6_add_qml_module target)
string(APPEND qmldir_file_contents "plugin ${target}${QT_LIBINFIX}\n")
endif()
- if (arg_CLASSNAME)
- string(APPEND qmldir_file_contents "classname ${arg_CLASSNAME}\n")
+ if (arg_CLASS_NAME)
+ string(APPEND qmldir_file_contents "classname ${arg_CLASS_NAME}\n")
endif()
if (arg_DESIGNER_SUPPORTED)
string(APPEND qmldir_file_contents "designersupported\n")
@@ -1162,6 +1181,8 @@ but this file does not exist. Possible reasons include:
# Small macro to avoid duplicating code in two different loops.
macro(_qt6_QmlImportScanner_parse_entry)
+ # TODO: Should CLASSNAME be changed to CLASS_NAME? It is generated by
+ # the qmlimportscanner, not CMake code.
set(entry_name "qml_import_scanner_import_${idx}")
cmake_parse_arguments("entry"
""