Use CMAKE_MESSAGE_CONTEXT for Better CMake Output Messages

Each module now identifies its actions during the configuration by a
prefix, e.g., `[QtBase]`. In addition,

- I have slightly modified some of the `message()` commands to get
  a more coherent output.
- `syncqt.cpp` prints its output as WARNING if any

Change-Id: I3922d75a668d94f402068f4121751b7fcb6522b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Amir Masoud Abdol 2022-10-25 16:48:21 +02:00
parent 71e1393bb5
commit 5fcfacdb7f
4 changed files with 17 additions and 9 deletions

View File

@ -12,10 +12,14 @@ function(qt_run_config_test_architecture)
qt_get_platform_try_compile_vars(platform_try_compile_vars)
list(APPEND flags ${platform_try_compile_vars})
list(TRANSFORM flags PREPEND " " OUTPUT_VARIABLE flags_indented)
list(TRANSFORM flags PREPEND " " OUTPUT_VARIABLE flags_indented)
list(JOIN flags_indented "\n" flags_indented)
message(STATUS
"Building architecture extraction project with the following CMake arguments:\n${flags_indented}")
"Building architecture extraction project with the following CMake arguments:")
list(POP_BACK CMAKE_MESSAGE_CONTEXT _context)
message(NOTICE ${flags_indented})
list(APPEND CMAKE_MESSAGE_CONTEXT ${_context})
try_compile(
_arch_result

View File

@ -382,6 +382,8 @@ macro(qt_internal_prepare_single_repo_target_set_build)
endmacro()
macro(qt_build_repo_begin)
list(APPEND CMAKE_MESSAGE_CONTEXT "${PROJECT_NAME}")
qt_build_internals_set_up_private_api()
# Prevent installation in non-prefix builds.
@ -524,6 +526,8 @@ macro(qt_build_repo_end)
set(QT_INTERNAL_SYNCED_MODULES ${synced_modules} CACHE INTERNAL
"List of the synced modules. Prevents running syncqt.cpp after the first configuring.")
endif()
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
endmacro()
macro(qt_build_repo)

View File

@ -436,7 +436,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
"syncqt.cpp failed for module ${module}:\n${syncqt_output}")
endif()
if(syncqt_output)
message("${syncqt_output}")
message(WARNING "${syncqt_output}")
endif()
set_property(GLOBAL APPEND PROPERTY _qt_synced_modules ${module})
endif()

View File

@ -11,13 +11,13 @@
#
# We mean it.
message("CMAKE_VERSION: ${CMAKE_VERSION}")
message("CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
message("CMAKE_MODULES_UNDER_TEST: ${CMAKE_MODULES_UNDER_TEST}")
message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
message(STATUS "CMAKE_MODULES_UNDER_TEST: ${CMAKE_MODULES_UNDER_TEST}")
foreach(_mod ${CMAKE_MODULES_UNDER_TEST})
message("CMAKE_${_mod}_MODULE_MAJOR_VERSION: ${CMAKE_${_mod}_MODULE_MAJOR_VERSION}")
message("CMAKE_${_mod}_MODULE_MINOR_VERSION: ${CMAKE_${_mod}_MODULE_MINOR_VERSION}")
message("CMAKE_${_mod}_MODULE_PATCH_VERSION: ${CMAKE_${_mod}_MODULE_PATCH_VERSION}")
message(STATUS "CMAKE_${_mod}_MODULE_MAJOR_VERSION: ${CMAKE_${_mod}_MODULE_MAJOR_VERSION}")
message(STATUS "CMAKE_${_mod}_MODULE_MINOR_VERSION: ${CMAKE_${_mod}_MODULE_MINOR_VERSION}")
message(STATUS "CMAKE_${_mod}_MODULE_PATCH_VERSION: ${CMAKE_${_mod}_MODULE_PATCH_VERSION}")
endforeach()
# Generate a shell script wrapper that calls ninja with -v parameter.