From 8ae1552a5b4b175c72a793e08ba8a7cd03020e92 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Sat, 5 Dec 2020 13:28:20 +0000 Subject: [PATCH] cmake: avoid excessive output from cmake --trace/--trace-expand - `cmake . --trace-expand -DCMAKE_TRACE_MODE=1` --- cmake/OpenCVUtils.cmake | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 6ae2cbc..735fa10 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -8,7 +8,20 @@ include(CMakeParseArguments) function(ocv_cmake_dump_vars) set(OPENCV_SUPPRESS_DEPRECATIONS 1) # suppress deprecation warnings from variable_watch() guards get_cmake_property(__variableNames VARIABLES) - cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN}) + cmake_parse_arguments(DUMP "FORCE" "TOFILE" "" ${ARGN}) + + # avoid generation of excessive logs with "--trace" or "--trace-expand" parameters + # Note: `-DCMAKE_TRACE_MODE=1` should be passed to CMake through command line. It is not a CMake buildin variable for now (2020-12) + # Use `cmake . -UCMAKE_TRACE_MODE` to remove this variable from cache + if(CMAKE_TRACE_MODE AND NOT DUMP_FORCE) + if(DUMP_TOFILE) + file(WRITE ${CMAKE_BINARY_DIR}/${DUMP_TOFILE} "Skipped due to enabled CMAKE_TRACE_MODE") + else() + message(AUTHOR_WARNING "ocv_cmake_dump_vars() is skipped due to enabled CMAKE_TRACE_MODE") + endif() + return() + endif() + set(regex "${DUMP_UNPARSED_ARGUMENTS}") string(TOLOWER "${regex}" regex_lower) set(__VARS "") -- 2.7.4