@@ -248,31 +248,40 @@ macro(ocv_glob_modules)
248
248
foreach (__path ${ARGN} )
249
249
if ("${__path} " STREQUAL "EXTRA" )
250
250
set (OPENCV_PROCESSING_EXTRA_MODULES 1 )
251
- endif ()
252
- get_filename_component (__path "${__path} " ABSOLUTE )
251
+ else ()
252
+ get_filename_component (__path "${__path} " ABSOLUTE )
253
253
254
- list (FIND __directories_observed "${__path} " __pathIdx )
255
- if (__pathIdx GREATER -1 )
256
- message (FATAL_ERROR "The directory ${__path} is observed for OpenCV modules second time." )
257
- endif ()
258
- list (APPEND __directories_observed "${__path} " )
259
-
260
- file (GLOB __ocvmodules RELATIVE "${__path} " "${__path} /*" )
261
- if (__ocvmodules )
262
- list (SORT __ocvmodules )
263
- foreach (mod ${__ocvmodules} )
264
- get_filename_component (__modpath "${__path} /${mod} " ABSOLUTE )
265
- if (EXISTS "${__modpath} /CMakeLists.txt" )
266
-
267
- list (FIND __directories_observed "${__modpath} " __pathIdx )
268
- if (__pathIdx GREATER -1 )
269
- message (FATAL_ERROR "The module from ${__modpath} is already loaded." )
270
- endif ()
271
- list (APPEND __directories_observed "${__modpath} " )
254
+ list (FIND __directories_observed "${__path} " __pathIdx )
255
+ if (__pathIdx GREATER -1 )
256
+ message (FATAL_ERROR "The directory ${__path} is observed for OpenCV modules second time." )
257
+ endif ()
258
+ list (APPEND __directories_observed "${__path} " )
259
+
260
+ set (__count 0 )
261
+ file (GLOB __ocvmodules RELATIVE "${__path} " "${__path} /*" )
262
+ if (__ocvmodules )
263
+ list (SORT __ocvmodules )
264
+ foreach (mod ${__ocvmodules} )
265
+ get_filename_component (__modpath "${__path} /${mod} " ABSOLUTE )
266
+ if (EXISTS "${__modpath} /CMakeLists.txt" )
267
+
268
+ list (FIND __directories_observed "${__modpath} " __pathIdx )
269
+ if (__pathIdx GREATER -1 )
270
+ message (FATAL_ERROR "The module from ${__modpath} is already loaded." )
271
+ endif ()
272
+ list (APPEND __directories_observed "${__modpath} " )
272
273
273
- add_subdirectory ("${__modpath} " "${CMAKE_CURRENT_BINARY_DIR} /${mod} /.${mod} " )
274
- endif ()
275
- endforeach ()
274
+ add_subdirectory ("${__modpath} " "${CMAKE_CURRENT_BINARY_DIR} /${mod} /.${mod} " )
275
+
276
+ if (DEFINED OPENCV_MODULE_opencv_${mod}_LOCATION )
277
+ math (EXPR __count "${__count} + 1" )
278
+ endif ()
279
+ endif ()
280
+ endforeach ()
281
+ endif ()
282
+ if (OPENCV_PROCESSING_EXTRA_MODULES AND ${__count} LESS 1 )
283
+ message (SEND_ERROR "No extra modules found in folder: ${__path} \n Please provide path to 'opencv_contrib/modules' folder." )
284
+ endif ()
276
285
endif ()
277
286
endforeach ()
278
287
ocv_clear_vars (__ocvmodules __directories_observed __path __modpath __pathIdx )
0 commit comments