diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-11-02 20:45:01 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-11-03 13:06:14 +0100 |
commit | 9a50d62039179346b2d7f6de2756c912c1fd1dec (patch) | |
tree | 6e444a1f83ff00e7d10850712b62bcfb75144397 | |
parent | 72aab8b4875dc3b14ef4a72a881047f4ef619f3d (diff) |
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>
-rw-r--r-- | cmake/QtWriteArgsFile.cmake | 8 | ||||
-rw-r--r-- | configure.bat | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/cmake/QtWriteArgsFile.cmake b/cmake/QtWriteArgsFile.cmake index b4fa833f79..ddb390a146 100644 --- a/cmake/QtWriteArgsFile.cmake +++ b/cmake/QtWriteArgsFile.cmake @@ -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}") diff --git a/configure.bat b/configure.bat index 4c93e4b7e6..171074bc68 100644 --- a/configure.bat +++ b/configure.bat @@ -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" |