CMake: Ensure top-level builds are affected by our chosen log level

This will hide the configuration summary and cmake feature summary and
found packages output upon reconfiguration.

Task-number: QTBUG-104128
Change-Id: I42270b99e45076052ec176df4652661cae10ac0c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit b3d0325a8dca56d3163451a417edfe6015a4ffe0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2022-06-09 18:52:56 +02:00 committed by Qt Cherry-pick Bot
parent 6d6989dbeb
commit 77810099ce
2 changed files with 33 additions and 11 deletions

View File

@ -1,4 +1,13 @@
function(qt_print_feature_summary) function(qt_print_feature_summary)
if(QT_SUPERBUILD)
qt_internal_set_message_log_level(message_log_level)
if(message_log_level)
# In a top-level build, ensure that the feature_summary is affected by the
# selected log-level.
set(CMAKE_MESSAGE_LOG_LEVEL "${message_log_level}")
endif()
endif()
include(FeatureSummary) include(FeatureSummary)
# Show which packages were found. # Show which packages were found.
feature_summary(INCLUDE_QUIET_PACKAGES feature_summary(INCLUDE_QUIET_PACKAGES
@ -37,6 +46,15 @@ function(qt_print_build_instructions)
return() return()
endif() endif()
if(QT_SUPERBUILD)
qt_internal_set_message_log_level(message_log_level)
if(message_log_level)
# In a top-level build, ensure that qt_print_build_instructions is affected by the
# selected log-level.
set(CMAKE_MESSAGE_LOG_LEVEL "${message_log_level}")
endif()
endif()
set(build_command "cmake --build . --parallel") set(build_command "cmake --build . --parallel")
set(install_command "cmake --install .") set(install_command "cmake --install .")

View File

@ -23,18 +23,22 @@ if(FEATURE_developer_build)
set(_default_build_type "Debug") set(_default_build_type "Debug")
endif() endif()
# Decide whether output should be verbose or not. function(qt_internal_set_message_log_level out_var)
# Default to verbose (--log-level=STATUS) in a developer-build and # Decide whether output should be verbose or not.
# non-verbose (--log-level=NOTICE) otherwise. # Default to verbose (--log-level=STATUS) in a developer-build and
# If a custom CMAKE_MESSAGE_LOG_LEVEL was specified, it takes priority. # non-verbose (--log-level=NOTICE) otherwise.
# Passing an explicit --log-level=Foo has the highest priority. # If a custom CMAKE_MESSAGE_LOG_LEVEL was specified, it takes priority.
if(NOT CMAKE_MESSAGE_LOG_LEVEL) # Passing an explicit --log-level=Foo has the highest priority.
if(FEATURE_developer_build OR QT_FEATURE_developer_build) if(NOT CMAKE_MESSAGE_LOG_LEVEL)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS") if(FEATURE_developer_build OR QT_FEATURE_developer_build)
else() set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
set(CMAKE_MESSAGE_LOG_LEVEL "NOTICE") else()
set(CMAKE_MESSAGE_LOG_LEVEL "NOTICE")
endif()
set(${out_var} "${CMAKE_MESSAGE_LOG_LEVEL}" PARENT_SCOPE)
endif() endif()
endif() endfunction()
qt_internal_set_message_log_level(CMAKE_MESSAGE_LOG_LEVEL)
# Reset content of extra build internal vars for each inclusion of QtSetup. # Reset content of extra build internal vars for each inclusion of QtSetup.
unset(QT_EXTRA_BUILD_INTERNALS_VARS) unset(QT_EXTRA_BUILD_INTERNALS_VARS)