Skip to content

Commit

Permalink
CMake: Fix Windows top-level configure.bat
Browse files Browse the repository at this point in the history
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 2a29426.

Change-Id: I96da9094579fec29c290411677d6b538878399f4
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
jobor committed Nov 3, 2020
1 parent 72aab8b commit 9a50d62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion cmake/QtWriteArgsFile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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}")
4 changes: 2 additions & 2 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 9a50d62

Please sign in to comment.