From f128283c184dd650db4d9b62383a7db9d2bf8e98 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 8 Sep 2022 15:13:26 +0200 Subject: CMake: Correctly process root paths for qmlimportscanner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The values in _qt_additional_packages_prefix_paths end in /lib/cmake, because they are prefix paths, not root paths. Adding ./qml to the end of those paths would never result in valid qml import path locations on disk. Use __qt_internal_prefix_paths_to_roots from the Qt6 package to strip away that suffix, before adding ./qml. This should fix the Conan multiple root paths case, as well as builds of ExternalProject examples during a prefix build of qtdeclarative. Note that the examples will still not run without setting the QML_IMPORT_PATH env variable to point to the qtdeclarative/qml build directory, or creating a qt.conf file in the example build dir that sets the qml import path to the qtdeclarative build dir. Amends 8bf916bfcbd5a05ec7370179317cd6d3a7dbd905 Fixes: QTBUG-106431 Task-number: QTBUG-96232 Task-number: QTBUG-102339 Change-Id: I6d3dd2b82634efc0faf756d884816dfb8a6ff4b6 Reviewed-by: Ulf Hermann Reviewed-by: Jörg Bornemann (cherry picked from commit 727151e0e03b0b91e1dc83c205a8608d5d5c236b) Reviewed-by: Qt Cherry-pick Bot --- src/qml/Qt6QmlMacros.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/qml') diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 73b7335dd2..d26f183f5d 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -2008,7 +2008,9 @@ but this file does not exist. Possible reasons include: # We have multiple installation prefixes: one per Qt repository (conan). Add those that have # a "qml" subdirectory. set(qml_import_paths) - foreach(root IN ITEMS ${QT6_INSTALL_PREFIX} ${_qt_additional_packages_prefix_paths}) + __qt_internal_prefix_paths_to_roots( + additional_root_paths "${_qt_additional_packages_prefix_paths}") + foreach(root IN ITEMS ${QT6_INSTALL_PREFIX} ${additional_root_paths}) set(candidate "${root}/${QT6_INSTALL_QML}") if(IS_DIRECTORY "${candidate}") list(APPEND qml_import_paths "${candidate}") -- cgit v1.2.3