diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-02-24 11:44:11 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-02-25 12:32:26 +0000 |
commit | 1d1eaa29f3dba698be3f5c7fd8aadf0444246990 (patch) | |
tree | 98a072d2e30d84cfec80eba0e7ad6456b61afb5c /cmake/qt.toolchain.cmake.in | |
parent | 335d399cc5855ba38c31fe70d5139973e0a48a89 (diff) |
CMake: Read QT_HOST_PATH from the environment too
For cross-compiled conan packages we need conan to export QT_HOST_PATH
as an environment variable. The Qt build now picks up this environment
variable if no QT_HOST_PATH cache variable was specified.
Change-Id: I0c3e15e82842061d5db81949ffcc1c240f6ed6a4
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 599c648b77628fe195e78d6e7ac145f258f8880b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake/qt.toolchain.cmake.in')
-rw-r--r-- | cmake/qt.toolchain.cmake.in | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cmake/qt.toolchain.cmake.in b/cmake/qt.toolchain.cmake.in index 9054e9c4ef..6e37ae0281 100644 --- a/cmake/qt.toolchain.cmake.in +++ b/cmake/qt.toolchain.cmake.in @@ -167,10 +167,16 @@ set(__qt_toolchain_initial_qt_host_path set(__qt_toolchain_initial_qt_host_path_cmake_dir "@qt_host_path_cmake_dir_absolute@") -# Prefer initially configured path if none was explicitly set. -if(NOT DEFINED QT_HOST_PATH AND __qt_toolchain_initial_qt_host_path - AND EXISTS "${__qt_toolchain_initial_qt_host_path}") - set(QT_HOST_PATH "${__qt_toolchain_initial_qt_host_path}" CACHE PATH "") +# QT_HOST_PATH precedence: +# - cache variable / command line option +# - environment variable +# - initial QT_HOST_PATH when qtbase was configured (and the directory exists) +if(NOT DEFINED QT_HOST_PATH) + if(DEFINED ENV{QT_HOST_PATH}) + set(QT_HOST_PATH "$ENV{QT_HOST_PATH}" CACHE PATH "") + else(__qt_toolchain_initial_qt_host_path AND EXISTS "${__qt_toolchain_initial_qt_host_path}") + set(QT_HOST_PATH "${__qt_toolchain_initial_qt_host_path}" CACHE PATH "") + endif() endif() if(NOT QT_HOST_PATH STREQUAL "") |