summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2023-09-01 16:39:59 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2023-09-20 21:20:13 +0200
commit8ffb6ce64cb0183bf6805497b398463549c1ed8d (patch)
tree0916044a319ee565961de5adf3ee8f5d2a556084
parent5c8910adfd613382e97c5517e85e9088a2abbe3e (diff)
CMake: Add a config.redo script similar to qt5's config.status
The config.redo script can be executed to reconfigure a pre-existing qt build dir with the configure options that were last passed to the build. It just calls the original configure script with the -redo option. It's nicer than calling configure + -redo manually because you don't need to write out the full source path for configure. In qt 5 times this script was called config.status. On windows the script is called config.redo.bat. Rename the config.redo file that QtWriteArgsFile.cmake writes to to config.redo.last, so it doesn't conflict with the name of new config.redo script. Amends 5c40cb0f1a8fad03edb3ef0f97df15e9dd643bdf Pick-to: 6.5 6.6 Change-Id: Id47c56a24561410aec6fbaa79b13fc8a78d12ed0 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
-rw-r--r--cmake/QtWrapperScriptHelpers.cmake39
-rwxr-xr-xconfigure2
-rw-r--r--configure.bat2
-rw-r--r--libexec/qt-internal-config.redo.bat.in1
-rwxr-xr-xlibexec/qt-internal-config.redo.in2
5 files changed, 44 insertions, 2 deletions
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 "$@"