summaryrefslogtreecommitdiffstats
path: root/cmake/qt.toolchain.cmake.in
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/qt.toolchain.cmake.in')
-rw-r--r--cmake/qt.toolchain.cmake.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmake/qt.toolchain.cmake.in b/cmake/qt.toolchain.cmake.in
index 63e5ee3d59..d623d9c0fb 100644
--- a/cmake/qt.toolchain.cmake.in
+++ b/cmake/qt.toolchain.cmake.in
@@ -11,8 +11,14 @@ if(qt_chainload_toolchain_file)
unset(qt_chainload_toolchain_file)
endif()
-list(PREPEND CMAKE_PREFIX_PATH "@CMAKE_INSTALL_PREFIX@")
-list(PREPEND CMAKE_FIND_ROOT_PATH "@CMAKE_INSTALL_PREFIX@")
+# Compute dynamically the Qt installation prefix from the location of this file. This allows
+# the usage of the toolchain file when the Qt installation is relocated.
+get_filename_component(QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX
+ ${CMAKE_CURRENT_LIST_DIR}/../@qt_path_from_cmake_config_dir_to_prefix@
+ ABSOLUTE)
+
+list(PREPEND CMAKE_PREFIX_PATH "${QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX}")
+list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX}")
if(QT_HOST_PATH)
list(APPEND CMAKE_PREFIX_PATH "${QT_HOST_PATH}")