From c4e09cf26790d6d293efd0e389517dcaf7f34d85 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 28 May 2020 16:29:17 +0200 Subject: CMake: pro2cmake: Check existence of QMLTYPES_INSTALL_DIR When writing the qt6_qml_type_registration call, make sure to write the set(QT_QML_MODULE_INSTALL_QMLTYPES TRUE) statement only if an explicit path was provided via QMLTYPES_INSTALL_DIR / QT_QML_MODULE_INSTALL_DIR. This will remove the QT_QML_MODULE_INSTALL_QMLTYPES property from many examples and tests in qtdeclarative, thus not installing the .qmltypes file into the Qt prefix, thus polluting it. Task-number: QTBUG-84403 Change-Id: I5c64d42915896d14f2591cbb64d73d912dbf7c7d Reviewed-by: Qt CI Bot Reviewed-by: Joerg Bornemann --- util/cmake/pro2cmake.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 71ef931800..49a3917c77 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -3816,7 +3816,10 @@ def handle_app_or_lib( # that is not a qml plugin if "qmltypes" in scope.get("CONFIG") and "qml_plugin" not in scope.get("_LOADED"): cm_fh.write(f"\n{spaces(indent)}set_target_properties({target} PROPERTIES\n") - cm_fh.write(f"{spaces(indent+1)}QT_QML_MODULE_INSTALL_QMLTYPES TRUE\n") + + install_dir = scope.expandString("QMLTYPES_INSTALL_DIR") + if install_dir: + cm_fh.write(f"{spaces(indent+1)}QT_QML_MODULE_INSTALL_QMLTYPES TRUE\n") import_version = get_qml_import_version(scope, target) if import_version: @@ -3834,7 +3837,6 @@ def handle_app_or_lib( if target_path: cm_fh.write(f"{spaces(indent+1)}QT_QML_MODULE_TARGET_PATH {target_path}\n") - install_dir = scope.expandString("QMLTYPES_INSTALL_DIR") if install_dir: install_dir = install_dir.replace("$$[QT_INSTALL_QML]", "${INSTALL_QMLDIR}") cm_fh.write(f'{spaces(indent+1)}QT_QML_MODULE_INSTALL_DIR "{install_dir}"\n') -- cgit v1.2.3