Merge pull request #5884 from alalek:cmake_vars
This commit is contained in:
commit
68eab8ea00
@ -98,6 +98,8 @@ endif()
|
||||
|
||||
include(cmake/OpenCVUtils.cmake)
|
||||
|
||||
ocv_cmake_eval(DEBUG_PRE ONCE)
|
||||
|
||||
ocv_clear_vars(OpenCVModules_TARGETS)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -1254,3 +1256,7 @@ endif()
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
include(cmake/OpenCVPackaging.cmake)
|
||||
|
||||
# This should be the last command
|
||||
ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
|
||||
ocv_cmake_eval(DEBUG_POST ONCE)
|
||||
|
@ -1,11 +1,15 @@
|
||||
include(CMakeParseArguments)
|
||||
|
||||
# Debugging function
|
||||
function(ocv_cmake_dump_vars)
|
||||
set(VARS "")
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN})
|
||||
set(regex "${DUMP_UNPARSED_ARGUMENTS}")
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
set(VARS "")
|
||||
string(TOLOWER "${regex}" regex_lower)
|
||||
foreach(_variableName ${_variableNames})
|
||||
if(_variableName MATCHES "${regex}")
|
||||
string(TOLOWER "${_variableName}" _variableName_lower)
|
||||
if(_variableName MATCHES "${regex}" OR _variableName_lower MATCHES "${regex_lower}")
|
||||
set(VARS "${VARS}${_variableName}=${${_variableName}}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
@ -16,6 +20,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