Merge pull request #5195 from mshabunin:warn-missing-contrib

This commit is contained in:
Alexander Alekhin 2015-08-20 12:36:00 +00:00
commit 3afe8832c5

View File

@ -248,31 +248,40 @@ macro(ocv_glob_modules)
foreach(__path ${ARGN}) foreach(__path ${ARGN})
if("${__path}" STREQUAL "EXTRA") if("${__path}" STREQUAL "EXTRA")
set(OPENCV_PROCESSING_EXTRA_MODULES 1) set(OPENCV_PROCESSING_EXTRA_MODULES 1)
endif() else()
get_filename_component(__path "${__path}" ABSOLUTE) get_filename_component(__path "${__path}" ABSOLUTE)
list(FIND __directories_observed "${__path}" __pathIdx) list(FIND __directories_observed "${__path}" __pathIdx)
if(__pathIdx GREATER -1) if(__pathIdx GREATER -1)
message(FATAL_ERROR "The directory ${__path} is observed for OpenCV modules second time.") message(FATAL_ERROR "The directory ${__path} is observed for OpenCV modules second time.")
endif() endif()
list(APPEND __directories_observed "${__path}") list(APPEND __directories_observed "${__path}")
file(GLOB __ocvmodules RELATIVE "${__path}" "${__path}/*") set(__count 0)
if(__ocvmodules) file(GLOB __ocvmodules RELATIVE "${__path}" "${__path}/*")
list(SORT __ocvmodules) if(__ocvmodules)
foreach(mod ${__ocvmodules}) list(SORT __ocvmodules)
get_filename_component(__modpath "${__path}/${mod}" ABSOLUTE) foreach(mod ${__ocvmodules})
if(EXISTS "${__modpath}/CMakeLists.txt") get_filename_component(__modpath "${__path}/${mod}" ABSOLUTE)
if(EXISTS "${__modpath}/CMakeLists.txt")
list(FIND __directories_observed "${__modpath}" __pathIdx) list(FIND __directories_observed "${__modpath}" __pathIdx)
if(__pathIdx GREATER -1) if(__pathIdx GREATER -1)
message(FATAL_ERROR "The module from ${__modpath} is already loaded.") message(FATAL_ERROR "The module from ${__modpath} is already loaded.")
endif()
list(APPEND __directories_observed "${__modpath}")
add_subdirectory("${__modpath}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
if (DEFINED OPENCV_MODULE_opencv_${mod}_LOCATION)
math(EXPR __count "${__count} + 1")
endif()
endif() endif()
list(APPEND __directories_observed "${__modpath}") endforeach()
endif()
add_subdirectory("${__modpath}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}") if (OPENCV_PROCESSING_EXTRA_MODULES AND ${__count} LESS 1)
endif() message(SEND_ERROR "No extra modules found in folder: ${__path}\nPlease provide path to 'opencv_contrib/modules' folder.")
endforeach() endif()
endif() endif()
endforeach() endforeach()
ocv_clear_vars(__ocvmodules __directories_observed __path __modpath __pathIdx) ocv_clear_vars(__ocvmodules __directories_observed __path __modpath __pathIdx)