[opencv] 52/89: cmake: add DEBUG_PRE/DEBUG_POST commands handling

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sat May 13 09:57:25 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 5ac15f09ed96c57cfecbfc1b7b5ca3102f5b58a2
Author: Alexander Alekhin <alexander.alekhin at itseez.com>
Date:   Fri Jan 15 14:03:48 2016 +0300

    cmake: add DEBUG_PRE/DEBUG_POST commands handling
    
    Useful for debug purposes:
        cmake -DDEBUG_POST="ocv_cmake_dump_vars(CUDA)" .
        cmake -DCMAKE_PRE="ocv_cmake_dump_vars(\"OPENCL|opencl\")" .
---
 CMakeLists.txt          |  3 +++
 cmake/OpenCVUtils.cmake | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 41f1d25..fe43ce0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,6 +73,8 @@ endif()
 
 include(cmake/OpenCVUtils.cmake)
 
+ocv_cmake_eval(DEBUG_PRE ONCE)
+
 ocv_clear_vars(OpenCVModules_TARGETS)
 
 # ----------------------------------------------------------------------------
@@ -1110,3 +1112,4 @@ include(cmake/OpenCVPackaging.cmake)
 
 # This should be the last command
 ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
+ocv_cmake_eval(DEBUG_POST ONCE)
diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake
index ce2cfae..093e8b7 100644
--- a/cmake/OpenCVUtils.cmake
+++ b/cmake/OpenCVUtils.cmake
@@ -42,6 +42,16 @@ function(ocv_cmake_dump_vars)
   endif()
 endfunction()
 
+function(ocv_cmake_eval var_name)
+  if(DEFINED ${var_name})
+    file(WRITE "${CMAKE_BINARY_DIR}/CMakeCommand-${var_name}.cmake" ${${var_name}})
+    include("${CMAKE_BINARY_DIR}/CMakeCommand-${var_name}.cmake")
+  endif()
+  if(";${ARGN};" MATCHES ";ONCE;")
+    unset(${var_name} CACHE)
+  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