Merge pull request #9186 from alalek:cmake_fix_dump_duplication

pull/9190/head
Alexander Alekhin 8 years ago
commit 02829f73e0
  1. 17
      cmake/OpenCVUtils.cmake

@ -2,21 +2,22 @@ include(CMakeParseArguments)
# Debugging function # Debugging function
function(ocv_cmake_dump_vars) function(ocv_cmake_dump_vars)
set(VARS "") get_cmake_property(__variableNames VARIABLES)
get_cmake_property(_variableNames VARIABLES)
cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN}) cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN})
set(regex "${DUMP_UNPARSED_ARGUMENTS}") set(regex "${DUMP_UNPARSED_ARGUMENTS}")
string(TOLOWER "${regex}" regex_lower) string(TOLOWER "${regex}" regex_lower)
foreach(_variableName ${_variableNames}) set(__VARS "")
string(TOLOWER "${_variableName}" _variableName_lower) foreach(__variableName ${__variableNames})
if(_variableName MATCHES "${regex}" OR _variableName_lower MATCHES "${regex_lower}") string(TOLOWER "${__variableName}" __variableName_lower)
set(VARS "${VARS}${_variableName}=${${_variableName}}\n") if((__variableName MATCHES "${regex}" OR __variableName_lower MATCHES "${regex_lower}")
AND NOT __variableName_lower MATCHES "^__")
set(__VARS "${__VARS}${__variableName}=${${__variableName}}\n")
endif() endif()
endforeach() endforeach()
if(DUMP_TOFILE) if(DUMP_TOFILE)
file(WRITE ${CMAKE_BINARY_DIR}/${DUMP_TOFILE} "${VARS}") file(WRITE ${CMAKE_BINARY_DIR}/${DUMP_TOFILE} "${__VARS}")
else() else()
message(AUTHOR_WARNING "${VARS}") message(AUTHOR_WARNING "${__VARS}")
endif() endif()
endfunction() endfunction()

Loading…
Cancel
Save