aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2022-04-21 14:37:58 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2022-06-04 15:25:54 +0200
commit39e090499e2ab22e096501a4858fbdb6f90ade9b (patch)
tree192538ce430ec7f44d54d0ffd8ce52b709e39295 /src/qml
parent5645c11bc7ee4fd59c18e6299584e566b6b2a00c (diff)
CMake: Fix qmlimportscanner call for conan
QtQuick examples could not be built properly when qtdeclarative was installed via conan. This was, because we passed the qtbase installation prefix + "/qml" to qmlimportscanner as QML import path. However, the qtbase installation prefix doesn't contain QML imports in the conan case. When using conan, we have multiple install prefixes. We must check each of these prefixes for a "qml" subdirectory and pass it to qmlimportscanner. Fixes: QTBUG-102339 Change-Id: Ife769774d0ff7d0a580314781b525a71b03c0c8c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> (cherry picked from commit 8bf916bfcbd5a05ec7370179317cd6d3a7dbd905)
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/Qt6QmlMacros.cmake27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index 96b66b18e8..4f3cf714b9 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -2000,10 +2000,27 @@ but this file does not exist. Possible reasons include:
")
endif()
- # Find location of qml dir.
- # TODO: qt.prf implies that there might be more than one qml import path to
- # pass to qmlimportscanner.
- set(qml_path "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_QML}")
+ # Find QML import paths.
+ if("${_qt_additional_packages_prefix_paths}" STREQUAL "")
+ # We have one installation prefix for all Qt modules. Add the "<prefix>/qml" directory.
+ set(qml_import_paths "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_QML}")
+ else()
+ # 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}")
+ set(candidate "${root}/${QT6_INSTALL_QML}")
+ if(IS_DIRECTORY "${candidate}")
+ list(APPEND qml_import_paths "${candidate}")
+ endif()
+ endforeach()
+ endif()
+
+ # Construct the -importPath arguments.
+ set(import_path_arguments)
+ foreach(path IN LISTS qml_import_paths)
+ list(APPEND import_path_arguments -importPath ${path})
+ endforeach()
# Small macro to avoid duplicating code in two different loops.
macro(_qt6_QmlImportScanner_parse_entry)
@@ -2027,7 +2044,7 @@ but this file does not exist. Possible reasons include:
set(cmd_args
-rootPath "${arg_PATH_TO_SCAN}"
-cmake-output
- -importPath "${qml_path}"
+ ${import_path_arguments}
)
get_target_property(qml_import_path ${target} QT_QML_IMPORT_PATH)