Skip to content

Commit

Permalink
CMake: Fix passing -DFOO=0 to configure.bat
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by:  Alexey Edelev <[email protected]>
  • Loading branch information
alcroito committed Feb 23, 2024
1 parent 3ec4a55 commit 0165a91
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 0165a91

Please sign in to comment.