summaryrefslogtreecommitdiffstats
path: root/cmake/QtBaseGlobalTargets.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-09-15 13:00:22 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-09-15 20:05:28 +0200
commit93fc3afe71467ca6aeffa41d7a6f4a170f82b62e (patch)
tree2a0c584c91fffed046ce12232d4513c9ee427b1d /cmake/QtBaseGlobalTargets.cmake
parent67567b8e0d15445aef7ce491930a6c1290122fac (diff)
CMake: Check that QT_HOST_PATH is set when using the Qt toolchain
If a consumer wants to cross-compile a Qt app, they need to provide the host Qt path location. When building Qt in the CI we embed the Qt host path into the generated CMake toolchain file for convenient building of other Qt modules. But once Qt is built, packaged and installed on a user's machine, most likely the Qt host path will not be the same. In such a case, if the user wants to use the convenience toolchain, they should explicitly provide the Qt host path via the QT_HOST_PATH and QT_HOST_PATH_CMAKE_DIR variables. Show an error message if the values are not provided or don't exist on the file system. It's possible that in the future the Qt installer will patch the toolchain file, or provide additional info, to point to the host Qt installation so that the user doesn't have to do it manually. But until that's done, a friendly error message is a good way to inform the user what they should do. Task-number: QTBUG-83999 Change-Id: I26291e3c47bb77375f8a5ce7b848c0382a660ca9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'cmake/QtBaseGlobalTargets.cmake')
-rw-r--r--cmake/QtBaseGlobalTargets.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index c5527f5915..5ffba66a77 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -109,6 +109,14 @@ set(__qt_initial_qt_host_path_cmake_dir \"${__qt_host_path_cmake_dir_absolute}\"
if(NOT DEFINED QT_HOST_PATH_CMAKE_DIR AND EXISTS \"\${__qt_initial_qt_host_path_cmake_dir}\")
set(QT_HOST_PATH_CMAKE_DIR \"\${__qt_initial_qt_host_path_cmake_dir}\" CACHE PATH \"\" FORCE)
endif()")
+
+ set(init_qt_host_path_checks "
+if(NOT QT_HOST_PATH OR NOT EXISTS \"\${QT_HOST_PATH}\")
+ message(FATAL_ERROR \"To use a cross-compiled Qt, please specify a path to a host Qt installation by setting the QT_HOST_PATH cache variable.\")
+endif()
+if(NOT QT_HOST_PATH_CMAKE_DIR OR NOT EXISTS \"\${QT_HOST_PATH_CMAKE_DIR}\")
+ message(FATAL_ERROR \"To use a cross-compiled Qt, please specify a path to a host Qt installation CMake directory by setting the QT_HOST_PATH_CMAKE_DIR cache variable.\")
+endif()")
endif()
if(CMAKE_TOOLCHAIN_FILE)