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)
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)
# Show which packages were found.
feature_summary(INCLUDE_QUIET_PACKAGES
@ -37,6 +46,15 @@ function(qt_print_build_instructions)
return()
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(install_command "cmake --install .")

View File

@ -23,18 +23,22 @@ 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")
function(qt_internal_set_message_log_level out_var)
# 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()
set(${out_var} "${CMAKE_MESSAGE_LOG_LEVEL}" PARENT_SCOPE)
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.
unset(QT_EXTRA_BUILD_INTERNALS_VARS)