summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-07-03 16:40:01 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-07-03 16:09:55 +0000
commit38640f745e8079e8fc860aa5ff162035b31572c2 (patch)
tree0eee3eb7c4dcaaae6ad4491e435ed812ad0c7fa1
parentd9da52d5616fed6f1d48422d82f23ad3dae946a9 (diff)
Fix toolchain path when doing non-prefix builds
Previously the cmake install prefix was added twice during a non-prefix build, which evaluated to an incorrect path. Set another absolute dir variable, and use that instead. Change-Id: I73099510dadc8f401d5a763f21840c9671686c10 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
-rw-r--r--bin/qt-cmake.bat.in2
-rwxr-xr-xbin/qt-cmake.in2
-rw-r--r--cmake/QtBaseGlobalTargets.cmake7
3 files changed, 9 insertions, 2 deletions
diff --git a/bin/qt-cmake.bat.in b/bin/qt-cmake.bat.in
index 3f33b4725b..a26e153068 100644
--- a/bin/qt-cmake.bat.in
+++ b/bin/qt-cmake.bat.in
@@ -1 +1 @@
-@CMAKE_COMMAND@ -DCMAKE_TOOLCHAIN_FILE=@CMAKE_INSTALL_PREFIX@/@__GlobalConfig_install_dir@/qt.toolchain.cmake %*
+@CMAKE_COMMAND@ -DCMAKE_TOOLCHAIN_FILE=@__GlobalConfig_install_dir_absolute@/qt.toolchain.cmake %*
diff --git a/bin/qt-cmake.in b/bin/qt-cmake.in
index efc8a850be..1797d2ded5 100755
--- a/bin/qt-cmake.in
+++ b/bin/qt-cmake.in
@@ -1,3 +1,3 @@
#!/bin/sh
-exec @CMAKE_COMMAND@ -DCMAKE_TOOLCHAIN_FILE=@CMAKE_INSTALL_PREFIX@/@__GlobalConfig_install_dir@/qt.toolchain.cmake $*
+exec @CMAKE_COMMAND@ -DCMAKE_TOOLCHAIN_FILE=@__GlobalConfig_install_dir_absolute@/qt.toolchain.cmake $*
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index 5936e7dcc6..059f528ca6 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -20,6 +20,13 @@ endif()
set(__GlobalConfig_path_suffix "${INSTALL_CMAKE_NAMESPACE}")
qt_path_join(__GlobalConfig_build_dir ${QT_CONFIG_BUILD_DIR} ${__GlobalConfig_path_suffix})
qt_path_join(__GlobalConfig_install_dir ${QT_CONFIG_INSTALL_DIR} ${__GlobalConfig_path_suffix})
+set(__GlobalConfig_install_dir_absolute "${__GlobalConfig_install_dir}")
+if(QT_WILL_INSTALL)
+ # Need to prepend the install prefix when doing prefix builds, because the config install dir
+ # is relative then.
+ qt_path_join(__GlobalConfig_install_dir_absolute
+ ${CMAKE_INSTALL_PREFIX} ${__GlobalConfig_install_dir_absolute})
+endif()
# Generate and install Qt6 config file.
configure_package_config_file(