From ad98a3bc729e002453537f6f036fcbe41aea2790 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 22 Feb 2024 19:53:48 +0100 Subject: [PATCH] CMake/Windows: add setlocal to the Windows bat files Several of the cmake bat files sets "script_dir_path". The problem is that those assignments are not local to the script files. E.g when qt-configure-module.bat gives it a value, and then call qt-cmake.bat, qt-cmake.bat will assign it a different value. And this value will overwrite the original value in qt-configure-module.bat. So when the call returns, that script can sometimes fail. This happens (for unknown reasons) if the Qt source code path contains a link to a different drive, created with mklink /d. This is typical if Windows is running in a virtual machine, and the Qt source code is shared with the host on e.g drive Q:. In that case you might want to a folder on C: be a symlink to Q:, in order to build Qt. This patch will make sure we add "setlocal" in all the affected bat files, so that any changes done to e.g "script_dir_path" stays local to each file. Pick-to: 6.6 6.5 Change-Id: Iee18e06eb0beece0c85c4345d9bfc0194e466e56 Reviewed-by: Alexandru Croitor (cherry picked from commit 458be44aebd441884502798c569cfcdfb06d15a9) Reviewed-by: Qt Cherry-pick Bot --- bin/qt-cmake-create.bat.in | 1 + bin/qt-cmake.bat.in | 1 + 2 files changed, 2 insertions(+) diff --git a/bin/qt-cmake-create.bat.in b/bin/qt-cmake-create.bat.in index ff8f7310e99..97faad8db72 100644 --- a/bin/qt-cmake-create.bat.in +++ b/bin/qt-cmake-create.bat.in @@ -1,4 +1,5 @@ @echo off +setlocal :: The directory of this script is the expanded absolute path of the "$qt_prefix/bin" directory. set script_dir_path=%~dp0 diff --git a/bin/qt-cmake.bat.in b/bin/qt-cmake.bat.in index 96d955d2a92..5d831ebce93 100644 --- a/bin/qt-cmake.bat.in +++ b/bin/qt-cmake.bat.in @@ -1,4 +1,5 @@ @echo off +setlocal :: The directory of this script is the expanded absolute path of the "$qt_prefix/bin" directory. set script_dir_path=%~dp0