Skip to content

Commit e29f355

Browse files
committed
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 <[email protected]>
1 parent ac0aac3 commit e29f355

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bin/qt-cmake.bat.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ set script_dir_path=%~dp0
77
set cmake_path=@CMAKE_COMMAND@
88
if not exist "%cmake_path%" set cmake_path=cmake
99

10-
set toolchain_path=%script_dir_path%\@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@\qt.toolchain.cmake
11-
"%cmake_path%" -DCMAKE_TOOLCHAIN_FILE="%toolchain_path%" @__qt_cmake_extra@ %*
10+
set CMAKE_TOOLCHAIN_FILE=%script_dir_path%\@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@\qt.toolchain.cmake
11+
"%cmake_path%" @__qt_cmake_extra@ %*

bin/qt-cmake.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ toolchain_path="$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_c
1616
@extra_qt_cmake_code@
1717

1818
# Find the qt toolchain relative to the absolute bin dir path where the script is located.
19-
exec "$cmake_path" -DCMAKE_TOOLCHAIN_FILE="$toolchain_path" @__qt_cmake_extra@ "$@"
19+
CMAKE_TOOLCHAIN_FILE="$toolchain_path"
20+
export CMAKE_TOOLCHAIN_FILE
21+
22+
exec "$cmake_path" @__qt_cmake_extra@ "$@"

0 commit comments

Comments
 (0)