summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2025-12-03 15:31:05 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2025-12-05 13:47:20 +0100
commite29f355c4d80d311c2d096724cc8d15982b69e4b (patch)
treedfee7200db4e1747d75c2e4a4b09d97c1adde0e8
parentac0aac35d7e4381aec9497084716bb4f92817923 (diff)
CMake: Make it possible to use qt-cmake with --build and --install
It wasn't possible to use the qt-cmake script with, e.g. the --build or --install argument, because we called cmake with -DCMAKE_TOOLCHAIN_FILE=..., and such arguments must be passed as the first argument. Since CMake 3.21 it's possible to pass the toolchain file via an environment variable. This patch changes qt-cmake and qt-cmake.bat accordingly. This is safe, because we require CMake 3.22 for building Qt since Qt 6.9. Pick-to: 6.10 Fixes: QTBUG-140785 Change-Id: I4b4bc729e80a0ab9fbe275cf2d3900111be3c1a3 Reviewed-by: Alexey Edelev <semlanik@gmail.com>
-rw-r--r--bin/qt-cmake.bat.in4
-rwxr-xr-xbin/qt-cmake.in5
2 files changed, 6 insertions, 3 deletions
diff --git a/bin/qt-cmake.bat.in b/bin/qt-cmake.bat.in
index 5d831ebce93..934f79c2599 100644
--- a/bin/qt-cmake.bat.in
+++ b/bin/qt-cmake.bat.in
@@ -7,5 +7,5 @@ set script_dir_path=%~dp0
set cmake_path=@CMAKE_COMMAND@
if not exist "%cmake_path%" set cmake_path=cmake
-set toolchain_path=%script_dir_path%\@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@\qt.toolchain.cmake
-"%cmake_path%" -DCMAKE_TOOLCHAIN_FILE="%toolchain_path%" @__qt_cmake_extra@ %*
+set CMAKE_TOOLCHAIN_FILE=%script_dir_path%\@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@\qt.toolchain.cmake
+"%cmake_path%" @__qt_cmake_extra@ %*
diff --git a/bin/qt-cmake.in b/bin/qt-cmake.in
index 363c490960c..5203e49f878 100755
--- a/bin/qt-cmake.in
+++ b/bin/qt-cmake.in
@@ -16,4 +16,7 @@ toolchain_path="$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_c
@extra_qt_cmake_code@
# Find the qt toolchain relative to the absolute bin dir path where the script is located.
-exec "$cmake_path" -DCMAKE_TOOLCHAIN_FILE="$toolchain_path" @__qt_cmake_extra@ "$@"
+CMAKE_TOOLCHAIN_FILE="$toolchain_path"
+export CMAKE_TOOLCHAIN_FILE
+
+exec "$cmake_path" @__qt_cmake_extra@ "$@"