summaryrefslogtreecommitdiffstats
path: root/configure.bat
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-02-21 17:18:30 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-02-26 16:06:47 +0000
commit5e41dde4cde2d880ef6321ab0f8e7ad5fe398130 (patch)
treea3b7c1e1d879789c6f8d9c9f708671a81bd9b1d3 /configure.bat
parentef77dbc43429d2fb628b5c290acc3b6932660277 (diff)
CMake: Fix passing -DFOO=0 to configure.bat
Add a space before the redirection operator, so that the '0' in '-DFOO=0' after '%*' expansion, does not get squished with the '<', effectively redirecting from '0>' instead of stdout. As a drive-by, also add a comment why we need the '.'. Pick-to: 6.5 Fixes: QTBUG-122622 Change-Id: I74ea3a1fe751cc1f2ad216b309f6b24d6d5f6b7f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 0165a91bff80722d2384914dd40ca65a20fc1a47) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 3d18b218ddda73ad79703026b38b4b9829cc6805)
Diffstat (limited to 'configure.bat')
-rw-r--r--configure.bat7
1 files changed, 6 insertions, 1 deletions
diff --git a/configure.bat b/configure.bat
index 32fcdd8626..7e45931751 100644
--- a/configure.bat
+++ b/configure.bat
@@ -83,7 +83,12 @@ set REDO_FILE_PATH=%TOPQTDIR%\config.redo.last
set REDO_TMP_FILE_PATH=%TOPQTDIR%\config.redo.in
set FRESH_REQUESTED_ARG=
if not defined redoing (
- echo.%*>"%OPT_TMP_FILE_PATH%"
+ :: The '.' in 'echo.%*' ensures we don't print "echo is off" when no arguments are passed
+ :: https://devblogs.microsoft.com/oldnewthing/20170802-00/?p=96735
+ :: The space before the '>' makes sure that when we have a digit at the end of the args, we
+ :: don't accidentally concatenate it with the '>' resulting in '0>' or '2>' which redirects
+ :: into the file from a stream different than stdout, leading to broken or empty content.
+ echo.%* >"%OPT_TMP_FILE_PATH%"
cmake -DIN_FILE="%OPT_TMP_FILE_PATH%" -DOUT_FILE="%OPT_FILE_PATH%" -DIGNORE_ARGS=-top-level -P "%QTSRC%\cmake\QtWriteArgsFile.cmake"
) else (