CMake: Fix Windows top-level configure.bat

We must write config.opt in the same directory we're reading it from.
We must not write the -top-level argument to config.opt.
This amends commit 2a29426e39.

Change-Id: I96da9094579fec29c290411677d6b538878399f4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-11-02 20:45:01 +01:00
parent 72aab8b487
commit 9a50d62039
2 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,9 @@
# This script takes the following arguments:
# OUT_FILE: The output file.
# SKIP_ARGS: Number of arguments to skip from the front of the arguments list.
# IGNORE_ARGS: List of arguments to be ignored, i.e. that are not written.
cmake_minimum_required(VERSION 3.3)
# Look for the -P argument to determine the start of the actual script arguments
math(EXPR stop "${CMAKE_ARGC} - 1")
@ -25,7 +28,10 @@ endif()
set(content "")
if(start LESS_EQUAL stop)
foreach(i RANGE ${start} ${stop})
string(APPEND content "${CMAKE_ARGV${i}}\n")
set(arg ${CMAKE_ARGV${i}})
if(NOT arg IN_LIST IGNORE_ARGS)
string(APPEND content "${arg}\n")
endif()
endforeach()
endif()
file(WRITE "${OUT_FILE}" "${content}")

View File

@ -314,14 +314,14 @@ cd "%TOPQTDIR%"
goto :eof
:cmake
cd "%TOPQTDIR%"
rem Write config.opt if we're not currently -redo'ing
if "%rargs%" == "" (
cmake -DOUT_FILE=config.opt -P "%QTSRC%\cmake\QtWriteArgsFile.cmake" %*
cmake -DOUT_FILE=config.opt -DIGNORE_ARGS=-top-level -P "%QTSRC%\cmake\QtWriteArgsFile.cmake" %*
)
rem Launch CMake-based configure
cd "%TOPQTDIR%"
set TOP_LEVEL_ARG=
if %TOPLEVEL% == true set TOP_LEVEL_ARG=-DTOP_LEVEL=TRUE
cmake -DOPTFILE=config.opt %TOP_LEVEL_ARG% -P "%QTSRC%\cmake\QtProcessConfigureArgs.cmake"