diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-09-24 11:39:26 +0200 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2019-09-24 12:54:57 +0000 |
commit | 6e2ca1d6cb12d37a00d0c61b1aac317df02ac786 (patch) | |
tree | 54c991497356c8a6259dac179a1b124cb817da79 | |
parent | d64fa78829893ef54fced18d0ed306a482794e02 (diff) |
Add SKIP_TYPE_REGISTRATION option to add_qml_module
If the qml files are not listed in the qmldir file they do not need
to be written again, since it is expected that they are registered
by the c++ plugin code.
Change-Id: I624aedb182583f942bf1d1a322861c47a64b5065
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
-rw-r--r-- | cmake/QtBuild.cmake | 8 | ||||
-rwxr-xr-x | util/cmake/pro2cmake.py | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 8f249a15fe..409907bf58 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -2049,12 +2049,15 @@ endfunction() # VERSION: Version of the qml module # QML_PLUGINDUMP_DEPENDENCIES: Path to a dependencies.json file to be consumed # with the ${target}_qmltypes target (optional) +# SKIP_TYPE_REGISTRATION: All qml files are expected to be registered by the +# c++ plugin code. # function(add_qml_module target) set(qml_module_optional_args DESIGNER_SUPPORTED DO_NOT_INSTALL + SKIP_TYPE_REGISTRATION ) set(qml_module_single_args @@ -2130,9 +2133,14 @@ function(add_qml_module target) set(designer_supported_arg DESIGNER_SUPPORTED) endif() + if (arg_SKIP_TYPE_REGISTRATION) + set(skip_registration_arg SKIP_TYPE_REGISTRATION) + endif() + qt6_add_qml_module(${target} ${designer_supported_arg} ${no_create_option} + ${skip_registration_arg} ${classname_arg} RESOURCE_PREFIX "/qt-project.org/imports" TARGET_PATH ${arg_TARGET_PATH} diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index a2bbce53f0..4a88bf95b8 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -2905,6 +2905,8 @@ def write_example( add_target += " DEPENDENCIES\n" for dep in qml_dir.depends: add_target += f" {dep[0]}/{dep[1]}\n" + if len(qml_dir.type_names) == 0: + add_target += " SKIP_TYPE_REGISTRATION\n" add_target += " INSTALL_LOCATION ${INSTALL_EXAMPLEDIR}\n)\n\n" add_target += f"target_sources({binary_name} PRIVATE" @@ -3056,6 +3058,8 @@ def write_qml_plugin( extra_lines.append("DEPENDENCIES") for dep in qml_dir.depends: extra_lines.append(f" {dep[0]}/{dep[1]}") + if len(qml_dir.type_names) == 0: + extra_lines.append("SKIP_TYPE_REGISTRATION") return qml_dir |