diff --git a/cmake/QtWrapperScriptHelpers.cmake b/cmake/QtWrapperScriptHelpers.cmake index a71dee74ff..628d5a77dd 100644 --- a/cmake/QtWrapperScriptHelpers.cmake +++ b/cmake/QtWrapperScriptHelpers.cmake @@ -208,6 +208,7 @@ function(qt_internal_create_wrapper_scripts) DESTINATION "${INSTALL_LIBEXECDIR}") qt_internal_create_qt_configure_tests_wrapper_script() + qt_internal_create_qt_configure_redo_script() endfunction() function(qt_internal_create_qt_configure_tests_wrapper_script) @@ -255,3 +256,41 @@ function(qt_internal_create_qt_configure_tests_wrapper_script) DESTINATION "${INSTALL_BINDIR}") endif() endfunction() + +# Create a shell wrapper script to reconfigure Qt with the original configure arguments and +# any additional ones passed. +# +# Removes CMakeCache.txt and friends, either manually, or using CMake's --fresh. +# +# The script is created in the root of the build dir and is called config.redo +# It has the same contents as the 'config.status' script we created in qt 5. +function(qt_internal_create_qt_configure_redo_script) + set(input_script_name "qt-internal-config.redo") + set(input_script_path "${CMAKE_CURRENT_SOURCE_DIR}/libexec/${input_script_name}") + + # We don't use QT_BUILD_DIR because we want the file in the root of the build dir in a top-level + # build. + set(output_script_name "config.redo") + set(output_path "${CMAKE_BINARY_DIR}/${output_script_name}") + + if(QT_SUPERBUILD) + set(configure_script_path "${Qt_SOURCE_DIR}") + else() + set(configure_script_path "${QtBase_SOURCE_DIR}") + endif() + string(APPEND configure_script_path "/configure") + + # Used in the file contents. + file(TO_NATIVE_PATH "${configure_script_path}" configure_path) + + if(CMAKE_HOST_UNIX) + string(APPEND input_script_path ".in") + set(newline_style "LF") + else() + string(APPEND input_script_path ".bat.in") + string(APPEND output_path ".bat") + set(newline_style "CRLF") + endif() + + configure_file("${input_script_path}" "${output_path}" @ONLY NEWLINE_STYLE ${newline_style}) +endfunction() diff --git a/configure b/configure index e57707dc0b..ee8362f33e 100755 --- a/configure +++ b/configure @@ -136,7 +136,7 @@ determineOptFilePath "$@" optfilepath=${outpathPrefix}/config.opt opttmpfilepath=${outpathPrefix}/config.opt.in -redofilepath=${outpathPrefix}/config.redo +redofilepath=${outpathPrefix}/config.redo.last redotmpfilepath=${outpathPrefix}/config.redo.in fresh_requested_arg= diff --git a/configure.bat b/configure.bat index 1da3740a24..32fcdd8626 100644 --- a/configure.bat +++ b/configure.bat @@ -79,7 +79,7 @@ cd "%TOPQTDIR%" rem Write config.opt if we're not currently -redo'ing set OPT_FILE_PATH=%TOPQTDIR%\config.opt set OPT_TMP_FILE_PATH=%TOPQTDIR%\config.opt.in -set REDO_FILE_PATH=%TOPQTDIR%\config.redo +set REDO_FILE_PATH=%TOPQTDIR%\config.redo.last set REDO_TMP_FILE_PATH=%TOPQTDIR%\config.redo.in set FRESH_REQUESTED_ARG= if not defined redoing ( diff --git a/libexec/qt-internal-config.redo.bat.in b/libexec/qt-internal-config.redo.bat.in new file mode 100644 index 0000000000..d12cf9aae2 --- /dev/null +++ b/libexec/qt-internal-config.redo.bat.in @@ -0,0 +1 @@ +@configure_path@ -redo %* diff --git a/libexec/qt-internal-config.redo.in b/libexec/qt-internal-config.redo.in new file mode 100755 index 0000000000..c0427d5538 --- /dev/null +++ b/libexec/qt-internal-config.redo.in @@ -0,0 +1,2 @@ +#!/bin/sh +@configure_path@ -redo "$@"