summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-03-01 17:11:03 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-03-04 17:32:46 +0100
commit9cbb14f25dee5e990ee16486bb94f8b67fa6bf1a (patch)
tree618063aa99c68071e0c73c27f41318141a470f23
parenta70354e7769faea576ac7e193a2bc05b895cdfec (diff)
CMake: Make configure less verbose by default
Only show the more verbose configure output when configuring with -developer-build (which matches --log-level=STATUS) Otherwise in a non-developer build, restrict the output to NOTICE+ message (includes WARNINGs and ERRORs). Developers can still pass a custom log level when configuring. For example -DCMAKE_MESSAGE_LOG_LEVEL=STATUS or --log-level=STATUS. The former method will be cached, while the latter is only applied to the current configure invocation. Also show the build instructions hint message only when configuring for the first time. [ChangeLog][CMake][configure] The configure output verbosity of non developer-builds of Qt is now reduced by default. Pass "-- --log-level=STATUS" to configure to make it verbose again. Change-Id: I7583a9c92142e0b1d7c5411b06403f40d8ebaf20 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit e2a0ddbb69640c94b4ee107260a088d5c1c7e273) Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--cmake/QtBuildInformation.cmake28
-rw-r--r--cmake/QtSetup.cmake13
2 files changed, 33 insertions, 8 deletions
diff --git a/cmake/QtBuildInformation.cmake b/cmake/QtBuildInformation.cmake
index a3adf81094..1b20a71afa 100644
--- a/cmake/QtBuildInformation.cmake
+++ b/cmake/QtBuildInformation.cmake
@@ -38,18 +38,30 @@ function(qt_print_build_instructions)
set(local_install_prefix "${CMAKE_STAGING_PREFIX}")
endif()
- message("Qt is now configured for building. Just run '${build_command}'\n")
+ set(msg "")
+
+ list(APPEND msg "Qt is now configured for building. Just run '${build_command}'\n")
if(QT_WILL_INSTALL)
- message("Once everything is built, you must run '${install_command}'")
- message("Qt will be installed into '${CMAKE_INSTALL_PREFIX}'")
+ list(APPEND msg "Once everything is built, you must run '${install_command}'")
+ list(APPEND msg "Qt will be installed into '${CMAKE_INSTALL_PREFIX}'")
else()
- message("Once everything is built, Qt is installed. You should NOT run '${install_command}'")
- message("Note that this build cannot be deployed to other machines or devices.")
+ list(APPEND msg
+ "Once everything is built, Qt is installed. You should NOT run '${install_command}'")
+ list(APPEND msg
+ "Note that this build cannot be deployed to other machines or devices.")
endif()
- message("\nTo configure and build other Qt modules, you can use the following convenience script:
+ list(APPEND msg
+ "\nTo configure and build other Qt modules, you can use the following convenience script:
${local_install_prefix}/${INSTALL_BINDIR}/${configure_module_command}")
- message("\nIf reconfiguration fails for some reason, try to remove 'CMakeCache.txt' \
+ list(APPEND msg "\nIf reconfiguration fails for some reason, try removing 'CMakeCache.txt' \
from the build directory \n")
+ list(JOIN msg "\n" msg)
+
+ if(NOT QT_INTERNAL_BUILD_INSTRUCTIONS_SHOWN)
+ message(STATUS "${msg}")
+ endif()
+
+ set(QT_INTERNAL_BUILD_INSTRUCTIONS_SHOWN "TRUE" CACHE STRING "" FORCE)
endfunction()
function(qt_configure_print_summary)
@@ -60,7 +72,7 @@ function(qt_configure_print_summary)
file(WRITE "${summary_file}" "")
# Show Qt-specific configure summary and any notes, wranings, etc.
if(__qt_configure_reports)
- message("Configure summary:\n${__qt_configure_reports}")
+ message(STATUS "Configure summary:\n${__qt_configure_reports}")
file(APPEND "${summary_file}" "${__qt_configure_reports}")
endif()
if(__qt_configure_notes)
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index 58f723e4de..17b81e9d49 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -23,6 +23,19 @@ if(FEATURE_developer_build)
set(_default_build_type "Debug")
endif()
+# Decide whether output should be verbose or not.
+# Default to verbose (--log-level=STATUS) in a developer-build and
+# non-verbose (--log-level=NOTICE) otherwise.
+# If a custom CMAKE_MESSAGE_LOG_LEVEL was specified, it takes priority.
+# Passing an explicit --log-level=Foo has the highest priority.
+if(NOT CMAKE_MESSAGE_LOG_LEVEL)
+ if(FEATURE_developer_build OR QT_FEATURE_developer_build)
+ set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
+ else()
+ set(CMAKE_MESSAGE_LOG_LEVEL "NOTICE")
+ endif()
+endif()
+
# Reset content of extra build internal vars for each inclusion of QtSetup.
unset(QT_EXTRA_BUILD_INTERNALS_VARS)