[opencv] 51/89: cmake: CMakeVars.txt (for debugging purpose)

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sat May 13 09:57:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 2.4.13.2
in repository opencv.

commit 36d7712c2c4906af43be108c8581648ceed1ec04
Author: Alexander Alekhin <alexander.a.alekhin at gmail.com>
Date:   Sun Nov 27 21:15:40 2016 +0300

    cmake: CMakeVars.txt (for debugging purpose)
---
 CMakeLists.txt          |  3 +++
 cmake/OpenCVUtils.cmake | 31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91a6462..41f1d25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1107,3 +1107,6 @@ endif()
 # ----------------------------------------------------------------------------
 
 include(cmake/OpenCVPackaging.cmake)
+
+# This should be the last command
+ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake
index 0241c43..ce2cfae 100644
--- a/cmake/OpenCVUtils.cmake
+++ b/cmake/OpenCVUtils.cmake
@@ -11,6 +11,37 @@ if(NOT COMMAND find_host_program)
   endmacro()
 endif()
 
+if(NOT COMMAND cmake_parse_arguments)
+  include(CMakeParseArguments OPTIONAL) # CMake 2.8.3+
+endif()
+
+# Debugging function
+function(ocv_cmake_dump_vars)
+  set(VARS "")
+  get_cmake_property(_variableNames VARIABLES)
+  if(COMMAND cmake_parse_arguments222)
+    cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN})
+    set(regex "${DUMP_UNPARSED_ARGUMENTS}")
+  else()
+    set(regex "${ARGV0}")
+    if(ARGV1 STREQUAL "TOFILE")
+      set(DUMP_TOFILE "${ARGV2}")
+    endif()
+  endif()
+  string(TOLOWER "${regex}" regex_lower)
+  foreach(_variableName ${_variableNames})
+    string(TOLOWER "${_variableName}" _variableName_lower)
+    if(_variableName MATCHES "${regex}" OR _variableName_lower MATCHES "${regex_lower}")
+      set(VARS "${VARS}${_variableName}=${${_variableName}}\n")
+    endif()
+  endforeach()
+  if(DUMP_TOFILE)
+    file(WRITE ${CMAKE_BINARY_DIR}/${DUMP_TOFILE} "${VARS}")
+  else()
+    message(AUTHOR_WARNING "${VARS}")
+  endif()
+endfunction()
+
 # assert macro
 # Note: it doesn't support lists in arguments
 # Usage samples:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list