Update -redo option such that it removes CMakeCache.txt and CMakeFiles/
In the case of re-doing, `configure` and `configure.bat` pass an extra parameter to the `QtProcessConfigureArgs.cmake`. As a result, CMake removes CMakeCache.txt and CMakeFiles/ before the reconfiguration. If the user is using CMake 3.24 or newer, this is achieved by passing the `--fresh` option to CMake call. In older CMake(s), CMakeCache.txt and CMakeFiles/ found in CMAKE_BINARY_DIR will be removed using a file(REMOVE_RECURSIVE call. [ChangeLog] The -redo option now additionally removes existing CMakeCache.txt file, and CMakeFiles/ directory, and recreates them from scratch. Task-number: QTBUG-108287 Change-Id: I11a5c8f9df1247d11eb7097552e6764463583346 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
4fb96669e3
commit
60968090ad
@ -93,7 +93,13 @@ function(qt_print_build_instructions)
|
|||||||
"\nTo configure and build other Qt modules, you can use the following convenience script:
|
"\nTo configure and build other Qt modules, you can use the following convenience script:
|
||||||
${local_install_prefix}/${INSTALL_BINDIR}/${configure_module_command}")
|
${local_install_prefix}/${INSTALL_BINDIR}/${configure_module_command}")
|
||||||
list(APPEND msg "\nIf reconfiguration fails for some reason, try removing 'CMakeCache.txt' \
|
list(APPEND msg "\nIf reconfiguration fails for some reason, try removing 'CMakeCache.txt' \
|
||||||
from the build directory \n")
|
from the build directory")
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
|
||||||
|
list(APPEND msg "Alternatively, you can add the --fresh flag to your CMake flags.\n")
|
||||||
|
else()
|
||||||
|
list(APPEND msg "\n")
|
||||||
|
endif()
|
||||||
|
|
||||||
list(JOIN msg "\n" msg)
|
list(JOIN msg "\n" msg)
|
||||||
|
|
||||||
if(NOT QT_INTERNAL_BUILD_INSTRUCTIONS_SHOWN)
|
if(NOT QT_INTERNAL_BUILD_INSTRUCTIONS_SHOWN)
|
||||||
|
@ -531,6 +531,10 @@ macro(qt_build_repo_end)
|
|||||||
qt_internal_save_previously_found_packages()
|
qt_internal_save_previously_found_packages()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(QT_INTERNAL_FRESH_REQUESTED)
|
||||||
|
set(QT_INTERNAL_FRESH_REQUESTED "FALSE" CACHE INTERNAL "")
|
||||||
|
endif()
|
||||||
|
|
||||||
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
|
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
@ -144,6 +144,15 @@ while(NOT "${configure_args}" STREQUAL "")
|
|||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
|
|
||||||
|
if(FRESH_REQUESTED)
|
||||||
|
push("-DQT_INTERNAL_FRESH_REQUESTED:BOOL=TRUE")
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
|
||||||
|
push("--fresh")
|
||||||
|
else()
|
||||||
|
file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/CMakeCache.txt"
|
||||||
|
"${CMAKE_BINARY_DIR}/CMakeFiles")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Define functions/macros that are called in configure.cmake files
|
# Define functions/macros that are called in configure.cmake files
|
||||||
|
@ -44,7 +44,9 @@ options without auto-detection.
|
|||||||
Configure meta:
|
Configure meta:
|
||||||
|
|
||||||
-help, -h ............ Display this help screen
|
-help, -h ............ Display this help screen
|
||||||
-redo ................ Re-configure with previously used options.
|
-redo ................ Re-configure with previously used options. In addition,
|
||||||
|
redo removes CMakeCache.txt file and CMakeFiles/ directory
|
||||||
|
and recreates them from scratch.
|
||||||
Additional options may be passed, but will not be
|
Additional options may be passed, but will not be
|
||||||
saved for later use by -redo.
|
saved for later use by -redo.
|
||||||
|
|
||||||
|
6
configure
vendored
6
configure
vendored
@ -221,6 +221,8 @@ checkTopLevelBuild "$@"
|
|||||||
parseCommandline "$@"
|
parseCommandline "$@"
|
||||||
handleHelp
|
handleHelp
|
||||||
determineOptFilePath "$@"
|
determineOptFilePath "$@"
|
||||||
|
|
||||||
|
fresh_requested_arg=
|
||||||
optfilename=config.opt
|
optfilename=config.opt
|
||||||
if [ -z "$optfile" ]; then # only write optfile if not currently redoing
|
if [ -z "$optfile" ]; then # only write optfile if not currently redoing
|
||||||
optfilepath=${outpathPrefix}${optfilename}
|
optfilepath=${outpathPrefix}${optfilename}
|
||||||
@ -231,6 +233,8 @@ if [ -z "$optfile" ]; then # only write optfile if not currently redoing
|
|||||||
fi
|
fi
|
||||||
echo $arg >> "$optfilepath"
|
echo $arg >> "$optfilepath"
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
fresh_requested_arg=-DFRESH_REQUESTED=TRUE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
top_level_arg=
|
top_level_arg=
|
||||||
@ -239,4 +243,4 @@ if [ -n "$CFG_TOPLEVEL" ]; then
|
|||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmake "-DOPTFILE=$optfilename" $top_level_arg -P "$relpath/cmake/QtProcessConfigureArgs.cmake"
|
cmake "-DOPTFILE=$optfilename" $top_level_arg $fresh_requested_arg -P "$relpath/cmake/QtProcessConfigureArgs.cmake"
|
||||||
|
@ -78,12 +78,15 @@ goto doneargs
|
|||||||
cd "%TOPQTDIR%"
|
cd "%TOPQTDIR%"
|
||||||
|
|
||||||
rem Write config.opt if we're not currently -redo'ing
|
rem Write config.opt if we're not currently -redo'ing
|
||||||
|
set FRESH_REQUESTED_ARG=
|
||||||
if "!rargs!" == "" (
|
if "!rargs!" == "" (
|
||||||
echo.%*>config.opt.in
|
echo.%*>config.opt.in
|
||||||
cmake -DIN_FILE=config.opt.in -DOUT_FILE=config.opt -DIGNORE_ARGS=-top-level -P "%QTSRC%\cmake\QtWriteArgsFile.cmake"
|
cmake -DIN_FILE=config.opt.in -DOUT_FILE=config.opt -DIGNORE_ARGS=-top-level -P "%QTSRC%\cmake\QtWriteArgsFile.cmake"
|
||||||
|
) else if NOT "!rargs!" == "" (
|
||||||
|
set FRESH_REQUESTED_ARG=-DFRESH_REQUESTED=TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
rem Launch CMake-based configure
|
rem Launch CMake-based configure
|
||||||
set TOP_LEVEL_ARG=
|
set TOP_LEVEL_ARG=
|
||||||
if %TOPLEVEL% == true set TOP_LEVEL_ARG=-DTOP_LEVEL=TRUE
|
if %TOPLEVEL% == true set TOP_LEVEL_ARG=-DTOP_LEVEL=TRUE
|
||||||
cmake -DOPTFILE=config.opt %TOP_LEVEL_ARG% -P "%QTSRC%\cmake\QtProcessConfigureArgs.cmake"
|
cmake -DOPTFILE=config.opt %TOP_LEVEL_ARG% %FRESH_REQUESTED_ARG% -P "%QTSRC%\cmake\QtProcessConfigureArgs.cmake"
|
||||||
|
Loading…
Reference in New Issue
Block a user