file(GLOB ocvmodules RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*") if(ocvmodules) list(SORT ocvmodules) endif() foreach(mod ${ocvmodules}) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${mod}/CMakeLists.txt") add_subdirectory("${mod}") endif() endforeach()