summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-09-17 12:16:47 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-09-22 22:20:43 +0200
commit25cc901f049cdabcffda02b640a9a684fca8caa4 (patch)
tree873b30b07e50e3b155f5468eac7e6c0d71eeb343
parent8d4eb292b2e8fc14437db97febdc2eebe36ed3ce (diff)
CMake: Fix configure -redo for top-level builds
When re-doing in a top-level build, we did not read the config.opt file from the top-level directory. Also, the config.opt file should not contain the -top-level argument. This is an internal option, and on Windows, it was already missing. The information whether we're doing a top-level build is now passed in the CMake variable TOP_LEVEL. Change-Id: Iaecd7306a4b6d9ad494684c201cf12f8e74d684b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtProcessConfigureArgs.cmake17
-rwxr-xr-xconfigure14
-rw-r--r--configure.bat4
3 files changed, 22 insertions, 13 deletions
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake
index 44ac0cc341..25910cf24c 100644
--- a/cmake/QtProcessConfigureArgs.cmake
+++ b/cmake/QtProcessConfigureArgs.cmake
@@ -6,6 +6,7 @@
# with one option per line.
# MODULE_ROOT: The source directory of the module to be built.
# If empty, qtbase/top-level is assumed.
+# TOP_LEVEL: TRUE, if this is a top-level build.
include(${CMAKE_CURRENT_LIST_DIR}/QtFeatureCommon.cmake)
@@ -31,7 +32,15 @@ else()
endif()
set(configure_filename "configure.cmake")
set(commandline_filename "qt_cmdline.cmake")
-set(commandline_files "${MODULE_ROOT}/${commandline_filename}")
+if(TOP_LEVEL)
+ get_filename_component(MODULE_ROOT "../.." ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
+ file(GLOB commandline_files "${MODULE_ROOT}/*/${commandline_filename}")
+ if(EXISTS "${MODULE_ROOT}/${commandline_filename}")
+ list(PREPEND commandline_files "${MODULE_ROOT}/${commandline_filename}")
+ endif()
+else()
+ set(commandline_files "${MODULE_ROOT}/${commandline_filename}")
+endif()
file(STRINGS "${OPTFILE}" configure_args)
list(FILTER configure_args EXCLUDE REGEX "^[ \t]*$")
list(TRANSFORM configure_args STRIP)
@@ -47,12 +56,6 @@ while(configure_args)
list(POP_FRONT configure_args generator)
elseif(arg STREQUAL "-cmake-use-default-generator")
set(auto_detect_generator FALSE)
- elseif(arg STREQUAL "-top-level")
- get_filename_component(MODULE_ROOT "../.." ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
- file(GLOB commandline_files "${MODULE_ROOT}/*/${commandline_filename}")
- if(EXISTS "${MODULE_ROOT}/${commandline_filename}")
- list(PREPEND commandline_files "${MODULE_ROOT}/${commandline_filename}")
- endif()
elseif(arg STREQUAL "-skip")
list(POP_FRONT configure_args qtrepo)
push("-DBUILD_${qtrepo}=OFF")
diff --git a/configure b/configure
index ab5f4f6991..328a9e72e7 100755
--- a/configure
+++ b/configure
@@ -559,8 +559,8 @@ while [ "$#" -gt 0 ]; do
BUILD_WITH_CMAKE=yes
;;
redo)
- if [ -f config.opt ]; then
- if grep -e ^-cmake <config.opt; then
+ if [ -f ${outpathPrefix}config.opt ]; then
+ if grep -e ^-cmake <${outpathPrefix}config.opt >/dev/null 2>&1; then
BUILD_WITH_CMAKE=yes
fi
fi
@@ -917,31 +917,35 @@ else
fi
}
+checkTopLevelBuild "$@"
parseCommandline "$@"
handleHelp
if [ "$BUILD_WITH_CMAKE" = "yes" ]; then
- checkTopLevelBuild "$@"
getOptAndQMakeCmdLines "$@"
optfilename=config.opt
if [ -z "$optfile" ]; then # only write optfile if not currently redoing
optfilepath=${outpathPrefix}${optfilename}
if [ -f "$optfilepath" ]; then rm "$optfilepath"; fi
for arg in "$@"; do
+ if [ "$arg" = "-top-level" ]; then
+ continue
+ fi
echo $arg >> "$optfilepath"
done
fi
+ top_level_arg=
if [ -n "$CFG_TOPLEVEL" ]; then
+ top_level_arg=-DTOP_LEVEL=TRUE
cd ..
fi
- cmake "-DOPTFILE=$optfilename" -P "$relpath/cmake/QtProcessConfigureArgs.cmake"
+ cmake "-DOPTFILE=$optfilename" $top_level_arg -P "$relpath/cmake/QtProcessConfigureArgs.cmake"
else
findPerl
findAwk
findMake
checkQMakeEnv
- checkTopLevelBuild "$@"
getOptAndQMakeCmdLines "$@"
detectOperatingSystem
maybeVerifyXcode
diff --git a/configure.bat b/configure.bat
index 4bb78f9069..8323f9ec85 100644
--- a/configure.bat
+++ b/configure.bat
@@ -316,4 +316,6 @@ if "%rargs%" == "" (
rem Launch CMake-based configure
cd "%TOPQTDIR%"
-cmake -DOPTFILE=config.opt -P "%QTSRC%\cmake\QtProcessConfigureArgs.cmake"
+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"