diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-05-28 18:52:53 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-05-29 10:01:31 +0200 |
commit | ee72ba123894bb92bcdd448d8a08eb1504d043eb (patch) | |
tree | fb65872fbda84bf1d9048f872e901f03efb39581 /src/qml/Qt6QmlMacros.cmake | |
parent | dc6b76d85dc03d0a6866069169562f8d1942fe56 (diff) |
CMake: Workaround fix to not install example metatypes.json files
We should not pollute the Qt install prefix lib/metatypes folder with
json files that were built as part of examples. Work around this, by
checking if the example qml module has an install path specified,
and install there instead.
Task-number: QTBUG-84403
Change-Id: I55fab7f4e2b02a74e28cf343a1aeecf59201d7cc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlMacros.cmake')
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index fd3f73e97d..6043624d5d 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -464,7 +464,18 @@ function(qt6_qml_type_registration target) endif() endif() - qt6_generate_meta_types_json_file(${target}) + # Horrible hack workaround to not install metatypes.json files for examples/ qml plugins into + # ${qt_prefix}/lib/meta_types. + # Put them into QT_QML_MODULE_INSTALL_DIR/lib/meta_types instead. + get_target_property(qml_install_dir ${target} QT_QML_MODULE_INSTALL_DIR) + set(meta_types_json_args "") + + if(QT_BUILDING_QT AND QT_WILL_INSTALL AND qml_install_dir AND + qml_install_dir MATCHES "^${INSTALL_EXAMPLESDIR}") + set(meta_types_json_args "INSTALL_DIR" "${qml_install_dir}/lib/metatypes") + endif() + + qt6_generate_meta_types_json_file(${target} ${meta_types_json_args}) get_target_property(import_version ${target} QT_QML_MODULE_VERSION) get_target_property(target_source_dir ${target} SOURCE_DIR) @@ -592,7 +603,6 @@ function(qt6_qml_type_registration target) # warn the user, and don't install the file. get_target_property(install_qmltypes ${target} QT_QML_MODULE_INSTALL_QMLTYPES) if (install_qmltypes) - get_target_property(qml_install_dir ${target} QT_QML_MODULE_INSTALL_DIR) if(qml_install_dir) if(NOT DEFINED QT_WILL_INSTALL OR QT_WILL_INSTALL) install(FILES ${plugin_types_file} DESTINATION "${qml_install_dir}") |