mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 03:00:14 +08:00
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\")" .
This commit is contained in:
parent
9d4ee2f54d
commit
9cd6731894
@ -98,6 +98,8 @@ endif()
|
||||
|
||||
include(cmake/OpenCVUtils.cmake)
|
||||
|
||||
ocv_cmake_eval(DEBUG_PRE ONCE)
|
||||
|
||||
ocv_clear_vars(OpenCVModules_TARGETS)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -1258,3 +1260,4 @@ include(cmake/OpenCVPackaging.cmake)
|
||||
|
||||
# This should be the last command
|
||||
ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
|
||||
ocv_cmake_eval(DEBUG_POST ONCE)
|
||||
|
@ -1,3 +1,5 @@
|
||||
include(CMakeParseArguments)
|
||||
|
||||
# Debugging function
|
||||
function(ocv_cmake_dump_vars)
|
||||
cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN})
|
||||
@ -16,6 +18,15 @@ 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()
|
||||
|
||||
# Search packages for host system instead of packages for target system
|
||||
# in case of cross compilation thess macro should be defined by toolchain file
|
||||
|
Loading…
Reference in New Issue
Block a user