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 <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-05-28 16:29:17 +02:00
parent f77c4ebb7d
commit c4e09cf267

View File

@ -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')