From: Alexander Alekhin Date: Sat, 5 Dec 2020 13:28:20 +0000 (+0000) Subject: cmake: avoid excessive output from cmake --trace/--trace-expand X-Git-Tag: accepted/tizen/unified/20220125.121719~1^2~1^2~264^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ae1552a5b4b175c72a793e08ba8a7cd03020e92;p=platform%2Fupstream%2Fopencv.git cmake: avoid excessive output from cmake --trace/--trace-expand - `cmake . --trace-expand -DCMAKE_TRACE_MODE=1` --- 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 "")