diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 0f212acf12..d6cdd0402c 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -305,9 +305,10 @@ macro(ocv_glob_modules) set(OPENCV_INITIAL_PASS OFF PARENT_SCOPE) set(OPENCV_INITIAL_PASS OFF) if(${BUILD_opencv_world}) - add_subdirectory("${OPENCV_MODULE_opencv_world_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/world") foreach(m ${OPENCV_MODULES_BUILD}) - if(NOT OPENCV_MODULE_${m}_IS_PART_OF_WORLD AND NOT ${m} STREQUAL opencv_world) + if("${m}" STREQUAL opencv_world) + add_subdirectory("${OPENCV_MODULE_opencv_world_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/world") + elseif(NOT OPENCV_MODULE_${m}_IS_PART_OF_WORLD AND NOT ${m} STREQUAL opencv_world) message(STATUS "Processing module ${m}...") if(m MATCHES "^opencv_") string(REGEX REPLACE "^opencv_" "" __shortname "${m}") @@ -446,6 +447,17 @@ function(__ocv_resolve_dependencies) list(APPEND deps_${m} ${d}) set(has_changes ON) endif() + if(BUILD_opencv_world + AND NOT "${m}" STREQUAL "opencv_world" + AND NOT "${m2}" STREQUAL "opencv_world" + AND OPENCV_MODULE_${m2}_IS_PART_OF_WORLD + AND NOT OPENCV_MODULE_${m}_IS_PART_OF_WORLD) + if(NOT (";${deps_${m}};" MATCHES ";opencv_world;")) +# message(STATUS " Transfer dependency opencv_world alias ${m2} to ${m}") + list(APPEND deps_${m} opencv_world) + set(has_changes ON) + endif() + endif() endforeach() endif() endforeach()