From dc4bc1e575a6e085f76200f9e4b96c6fb84cf313 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 21 Apr 2022 17:18:35 +0200 Subject: [PATCH] CMake: Fix interleaved configure output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit message(STATUS) prints output to a buffered stdout, whereas message(NOTICE) or just message() print to unbuffered stderr. We use a mix of message() calls when printing the configuration summary, which caused interleaved output. Because CMake offers no message(FLUSH), we work around the issue by calling execute_process(COMMAND -E echo " ") which does call std::cout << s << std::flush; We seem to have to do it twice, before and after the detailed configuration summary is printed. Pick-to: 6.2 6.3 Change-Id: Ibc075551fc0547073f0696477e54d9b9c1edca97 Reviewed-by: Jörg Bornemann --- cmake/QtBuildInformation.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/QtBuildInformation.cmake b/cmake/QtBuildInformation.cmake index 9676d5db780..a55b9310e28 100644 --- a/cmake/QtBuildInformation.cmake +++ b/cmake/QtBuildInformation.cmake @@ -98,7 +98,12 @@ function(qt_configure_print_summary) "-- Configure with --log-level=STATUS or higher to increase the output verbosity.") endif() + # Need 2 flushes to ensure no interleaved input is printed due to a mix of message(STATUS) + # and message(NOTICE) calls. + execute_process(COMMAND ${CMAKE_COMMAND} -E echo " ") message(STATUS "Configure summary:\n${__qt_configure_reports}") + execute_process(COMMAND ${CMAKE_COMMAND} -E echo " ") + file(APPEND "${summary_file}" "${__qt_configure_reports}") endif() if(__qt_configure_notes)