Merge pull request #19019 from alalek:cmake_avoid_excessive_trace_dump

This commit is contained in:
Alexander Alekhin 2020-12-07 20:40:56 +00:00
commit c6e60f06eb

View File

@ -8,7 +8,20 @@ include(CMakeParseArguments)
function(ocv_cmake_dump_vars) function(ocv_cmake_dump_vars)
set(OPENCV_SUPPRESS_DEPRECATIONS 1) # suppress deprecation warnings from variable_watch() guards set(OPENCV_SUPPRESS_DEPRECATIONS 1) # suppress deprecation warnings from variable_watch() guards
get_cmake_property(__variableNames VARIABLES) 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}") set(regex "${DUMP_UNPARSED_ARGUMENTS}")
string(TOLOWER "${regex}" regex_lower) string(TOLOWER "${regex}" regex_lower)
set(__VARS "") set(__VARS "")