diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-02-21 17:18:30 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-02-23 10:16:51 +0100 |
commit | 0165a91bff80722d2384914dd40ca65a20fc1a47 (patch) | |
tree | 041670c5dde8cbc45fc4e312a8a2a04db80766fd | |
parent | 3ec4a555599d352fa97272b8df612bf33e752878 (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 6.6 6.7
Fixes: QTBUG-122622
Change-Id: I74ea3a1fe751cc1f2ad216b309f6b24d6d5f6b7f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
-rw-r--r-- | configure.bat | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/configure.bat b/configure.bat index 0c4c11d39f..972f16594c 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 ( |