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.

Pick-to: 6.2 6.3
Change-Id: I7583a9c92142e0b1d7c5411b06403f40d8ebaf20
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2022-03-01 17:11:03 +01:00
parent 0deff80eab
commit e2a0ddbb69
2 changed files with 33 additions and 8 deletions

View File

@ -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 removing '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)

View File

@ -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)