cmake: process modules in the same CMake scope

This commit is contained in:
Alexander Alekhin 2021-07-21 04:06:31 +00:00
parent 39b91c97f0
commit 4015a5486c
27 changed files with 56 additions and 126 deletions

View File

@ -913,7 +913,7 @@ add_subdirectory(include)
ocv_add_modules_compiler_options()
# OpenCV modules
add_subdirectory(modules)
ocv_register_modules()
# Generate targets for documentation
add_subdirectory(doc)
@ -1243,7 +1243,7 @@ endif(WIN32)
# ========================== GUI ==========================
status("")
status(" GUI: ")
status(" GUI: " "${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
if(WITH_QT OR HAVE_QT)
if(HAVE_QT5)

View File

@ -254,7 +254,7 @@ function(_glob_locations out_paths out_names)
list(LENGTH paths before)
get_filename_component(path "${path}" ABSOLUTE)
# Either module itself
if(NOT path STREQUAL CMAKE_CURRENT_SOURCE_DIR AND EXISTS "${path}/CMakeLists.txt")
if(NOT path STREQUAL "${OpenCV_SOURCE_DIR}/modules" AND EXISTS "${path}/CMakeLists.txt")
get_filename_component(name "${path}" NAME)
list(APPEND paths "${path}")
list(APPEND names "${name}")
@ -296,7 +296,7 @@ macro(_add_modules_1 paths names)
list(GET ${names} ${i} __name)
#message(STATUS "First pass: ${__name} => ${__path}")
include("${__path}/cmake/init.cmake" OPTIONAL)
add_subdirectory("${__path}" "${CMAKE_CURRENT_BINARY_DIR}/.firstpass/${__name}")
add_subdirectory("${__path}" "${OpenCV_BINARY_DIR}/modules/.firstpass/${__name}")
endforeach()
endif()
endmacro()
@ -316,7 +316,7 @@ macro(_add_modules_2)
endif()
string(REGEX REPLACE "^opencv_" "" name "${m}")
#message(STATUS "Second pass: ${name} => ${OPENCV_MODULE_${m}_LOCATION}")
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${name}")
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${OpenCV_BINARY_DIR}/modules/${name}")
endif()
ocv_cmake_hook(POST_MODULES_CREATE_${the_module})
endforeach()
@ -369,7 +369,6 @@ macro(ocv_glob_modules main_root)
__ocv_resolve_dependencies()
# create modules
set(OPENCV_INITIAL_PASS OFF PARENT_SCOPE)
set(OPENCV_INITIAL_PASS OFF)
ocv_cmake_hook(PRE_MODULES_CREATE)
_add_modules_2(${OPENCV_MODULES_BUILD})
@ -377,6 +376,37 @@ macro(ocv_glob_modules main_root)
endmacro()
# called by root CMakeLists.txt
macro(ocv_register_modules)
if(NOT OPENCV_MODULES_PATH)
set(OPENCV_MODULES_PATH "${OpenCV_SOURCE_DIR}/modules")
endif()
ocv_glob_modules(${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
# build lists of modules to be documented
set(OPENCV_MODULES_MAIN "")
set(OPENCV_MODULES_EXTRA "")
foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
list(APPEND OPENCV_MODULES_MAIN ${mod})
else()
list(APPEND OPENCV_MODULES_EXTRA ${mod})
endif()
endforeach()
ocv_list_sort(OPENCV_MODULES_MAIN)
ocv_list_sort(OPENCV_MODULES_EXTRA)
set(FIXED_ORDER_MODULES core imgproc imgcodecs videoio highgui video calib3d features2d objdetect dnn ml flann photo stitching)
list(REMOVE_ITEM OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES})
set(OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES} ${OPENCV_MODULES_MAIN})
set(OPENCV_MODULES_MAIN ${OPENCV_MODULES_MAIN} CACHE INTERNAL "List of main modules" FORCE)
set(OPENCV_MODULES_EXTRA ${OPENCV_MODULES_EXTRA} CACHE INTERNAL "List of extra modules" FORCE)
endmacro()
# disables OpenCV module with missing dependencies
function(__ocv_module_turn_off the_module)
list(REMOVE_ITEM OPENCV_MODULES_DISABLED_AUTO "${the_module}")
@ -877,6 +907,7 @@ macro(ocv_create_module)
endmacro()
macro(_ocv_create_module)
add_definitions(-D__OPENCV_BUILD=1)
ocv_compiler_optimization_process_sources(OPENCV_MODULE_${the_module}_SOURCES OPENCV_MODULE_${the_module}_DEPS_EXT ${the_module})
set(__module_headers ${OPENCV_MODULE_${the_module}_HEADERS})

View File

@ -1,28 +0,0 @@
add_definitions(-D__OPENCV_BUILD=1)
if(NOT OPENCV_MODULES_PATH)
set(OPENCV_MODULES_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
ocv_glob_modules(${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
# build lists of modules to be documented
set(OPENCV_MODULES_MAIN "")
set(OPENCV_MODULES_EXTRA "")
foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
list(APPEND OPENCV_MODULES_MAIN ${mod})
else()
list(APPEND OPENCV_MODULES_EXTRA ${mod})
endif()
endforeach()
ocv_list_sort(OPENCV_MODULES_MAIN)
ocv_list_sort(OPENCV_MODULES_EXTRA)
set(FIXED_ORDER_MODULES core imgproc imgcodecs videoio highgui video calib3d features2d objdetect dnn ml flann photo stitching)
list(REMOVE_ITEM OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES})
set(OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES} ${OPENCV_MODULES_MAIN})
set(OPENCV_MODULES_MAIN ${OPENCV_MODULES_MAIN} CACHE INTERNAL "List of main modules" FORCE)
set(OPENCV_MODULES_EXTRA ${OPENCV_MODULES_EXTRA} CACHE INTERNAL "List of extra modules" FORCE)

View File

@ -218,7 +218,8 @@ endif()
if(NOT OPENCV_HIGHGUI_BUILTIN_BACKEND)
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "NONE")
endif()
message(STATUS "highgui: using builtin backend: ${OPENCV_HIGHGUI_BUILTIN_BACKEND}") # FIXIT: propagate to root CMake
message(STATUS "highgui: using builtin backend: ${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "${OPENCV_HIGHGUI_BUILTIN_BACKEND}" PARENT_SCOPE) # informational
if(TRUE)
# these variables are set by 'ocv_append_build_options(HIGHGUI ...)'

View File

@ -6,8 +6,6 @@ if(WITH_GTK)
if(HAVE_GTK3)
ocv_add_external_target(gtk3 "${GTK3_INCLUDE_DIRS}" "${GTK3_LIBRARIES}" "HAVE_GTK3;HAVE_GTK")
set(HAVE_GTK TRUE)
set(HAVE_GTK3 ${HAVE_GTK3} PARENT_SCOPE)
set(GTK3_VERSION "${GTK3_VERSION}" PARENT_SCOPE) # informational
endif()
endif()
if((PROJECT_NAME STREQUAL "OpenCV" AND HIGHGUI_ENABLE_PLUGINS) OR NOT HAVE_GTK3)
@ -19,8 +17,6 @@ if(WITH_GTK)
else()
ocv_add_external_target(gtk2 "${GTK2_INCLUDE_DIRS}" "${GTK2_LIBRARIES}" "HAVE_GTK2;HAVE_GTK")
set(HAVE_GTK TRUE)
set(HAVE_GTK2 ${HAVE_GTK2} PARENT_SCOPE)
set(GTK2_VERSION "${GTK2_VERSION}" PARENT_SCOPE) # informational
endif()
endif()
endif()
@ -29,15 +25,11 @@ if(WITH_GTK)
message(FATAL_ERROR "gthread not found. This library is required when building with GTK support")
else()
ocv_add_external_target(gthread "${GTHREAD_INCLUDE_DIRS}" "${GTHREAD_LIBRARIES}" "HAVE_GTHREAD")
set(HAVE_GTHREAD "${HAVE_GTHREAD}" PARENT_SCOPE) # informational
set(GTHREAD_VERSION "${GTHREAD_VERSION}" PARENT_SCOPE) # informational
endif()
if((WITH_OPENGL OR HAVE_OPENGL) AND HAVE_GTK2)
ocv_check_modules(GTKGLEXT gtkglext-1.0)
if(HAVE_GTKGLEXT)
ocv_add_external_target(gtkglext "${GTKGLEXT_INCLUDE_DIRS}" "${GTKGLEXT_LIBRARIES}" "HAVE_GTKGLEXT")
set(HAVE_GTKGLEXT "${HAVE_GTKGLEXT}" PARENT_SCOPE) # informational
set(GTKGLEXT_VERSION "${GTKGLEXT_VERSION}" PARENT_SCOPE) # informational
endif()
endif()
elseif(HAVE_GTK)
@ -48,9 +40,6 @@ if(WITH_OPENGL AND HAVE_GTKGLEXT)
find_package(OpenGL QUIET)
if(OPENGL_FOUND)
set(HAVE_OPENGL TRUE)
#set(HAVE_OPENGL ${HAVE_OPENGL} PARENT_SCOPE)
ocv_add_external_target(gtk_opengl "${OPENGL_INCLUDE_DIRS}" "${OPENGL_LIBRARIES}" "HAVE_OPENGL")
endif()
endif()
set(HAVE_GTK ${HAVE_GTK} PARENT_SCOPE)

View File

@ -13,5 +13,3 @@ if(WITH_WIN32UI)
ocv_add_external_target(win32ui "" "${__libs}" "HAVE_WIN32UI")
endif()
endif()
set(HAVE_WIN32UI "${HAVE_WIN32UI}" PARENT_SCOPE) # informational

View File

@ -27,20 +27,11 @@ endif()
include(FindPkgConfig)
# FIXIT: stop using PARENT_SCOPE in dependencies
if(PROJECT_NAME STREQUAL "OpenCV")
macro(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endmacro()
else()
function(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endfunction()
endif()
macro(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endmacro()
add_backend("gtk" WITH_GTK)
add_backend("win32ui" WITH_WIN32UI)

View File

@ -4,5 +4,3 @@ if(ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 23)
set(libs "-landroid -llog -lcamera2ndk")
ocv_add_external_target(android_native_camera "" "${libs}" "HAVE_ANDROID_NATIVE_CAMERA")
endif()
set(HAVE_ANDROID_NATIVE_CAMERA ${HAVE_ANDROID_NATIVE_CAMERA} PARENT_SCOPE)

View File

@ -4,5 +4,3 @@ if(ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 20)
set(libs "-landroid -llog -lmediandk")
ocv_add_external_target(android_mediandk "" "${libs}" "HAVE_ANDROID_MEDIANDK")
endif()
set(HAVE_ANDROID_MEDIANDK ${HAVE_ANDROID_MEDIANDK} PARENT_SCOPE)

View File

@ -21,7 +21,7 @@ if(NOT HAVE_ARAVIS_API)
string(REGEX REPLACE ".*ARAVIS_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*ARAVIS_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*ARAVIS_MICRO_VERSION[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}")
set(ARAVIS_VERSION "${ver_major}.${ver_minor}.${ver_micro}" PARENT_SCOPE) # informational
set(ARAVIS_VERSION "${ver_major}.${ver_minor}.${ver_micro}") # informational
set(ARAVIS_INCLUDE_DIRS "${ARAVIS_INCLUDE}")
set(ARAVIS_LIBRARIES "${ARAVIS_LIBRARY}")
endif()
@ -30,5 +30,3 @@ endif()
if(HAVE_ARAVIS_API)
ocv_add_external_target(aravis "${ARAVIS_INCLUDE_DIRS}" "${ARAVIS_LIBRARIES}" "HAVE_ARAVIS_API")
endif()
set(HAVE_ARAVIS_API ${HAVE_ARAVIS_API} PARENT_SCOPE)

View File

@ -14,5 +14,3 @@ if(APPLE)
endif()
ocv_add_external_target(avfoundation "" "${libs}" "HAVE_AVFOUNDATION")
endif()
set(HAVE_AVFOUNDATION ${HAVE_AVFOUNDATION} PARENT_SCOPE)

View File

@ -2,7 +2,6 @@
if(NOT HAVE_DC1394_2 AND PKG_CONFIG_FOUND)
ocv_check_modules(DC1394_2 libdc1394-2)
if(DC1394_2_FOUND)
set(DC1394_2_VERSION "${DC1394_2_VERSION}" PARENT_SCOPE) # informational
set(HAVE_DC1394_2 TRUE)
endif()
endif()
@ -20,12 +19,10 @@ if(NOT HAVE_DC1394_2)
set(HAVE_DC1394_2 TRUE)
set(DC1394_2_INCLUDE_DIRS "${DC1394_INCLUDE}")
set(DC1394_2_LIBRARIES "${DC1394_LIBRARY}")
set(DC1394_2_VERSION "unknown" PARENT_SCOPE) # informational
set(DC1394_2_VERSION "unknown") # informational
endif()
endif()
if(HAVE_DC1394_2)
ocv_add_external_target(dc1394_2 "${DC1394_2_INCLUDE_DIRS}" "${DC1394_2_LIBRARIES}" "HAVE_DC1394_2")
endif()
set(HAVE_DC1394_2 ${HAVE_DC1394_2} PARENT_SCOPE)

View File

@ -10,5 +10,3 @@ endif()
if(HAVE_DSHOW)
ocv_add_external_target(dshow "" "" "HAVE_DSHOW")
endif()
set(HAVE_DSHOW ${HAVE_DSHOW} PARENT_SCOPE)

View File

@ -14,11 +14,6 @@ if(NOT HAVE_FFMPEG AND WIN32 AND NOT ARM AND NOT OPENCV_FFMPEG_SKIP_DOWNLOAD)
download_win_ffmpeg(FFMPEG_CMAKE_SCRIPT)
if(FFMPEG_CMAKE_SCRIPT)
include("${FFMPEG_CMAKE_SCRIPT}")
set(FFMPEG_libavcodec_VERSION ${FFMPEG_libavcodec_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavformat_VERSION ${FFMPEG_libavformat_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavutil_VERSION ${FFMPEG_libavutil_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libswscale_VERSION ${FFMPEG_libswscale_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavresample_VERSION ${FFMPEG_libavresample_VERSION} PARENT_SCOPE) # info
set(HAVE_FFMPEG TRUE)
set(HAVE_FFMPEG_WRAPPER TRUE)
endif()
@ -132,5 +127,3 @@ elseif(HAVE_FFMPEG)
ocv_add_external_target(ffmpeg.plugin_deps "${__plugin_include_dirs}" "${__plugin_include_libs}" "${__plugin_defines}")
endif()
endif()
set(HAVE_FFMPEG ${HAVE_FFMPEG} PARENT_SCOPE)

View File

@ -9,5 +9,3 @@ endif()
if(HAVE_GPHOTO2)
ocv_add_external_target(gphoto2 "${GPHOTO2_INCLUDE_DIRS}" "${GPHOTO2_LIBRARIES}" "HAVE_GPHOTO2")
endif()
set(HAVE_GPHOTO2 ${HAVE_GPHOTO2} PARENT_SCOPE)

View File

@ -69,7 +69,7 @@ if(NOT HAVE_GSTREAMER AND WIN32)
string(REGEX REPLACE ".*GST_VERSION_MAJOR[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*GST_VERSION_MINOR[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*GST_VERSION_MICRO[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}")
set(GSTREAMER_VERSION "${ver_major}.${ver_minor}.${ver_micro}" PARENT_SCOPE) # informational
set(GSTREAMER_VERSION "${ver_major}.${ver_minor}.${ver_micro}") # informational
set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_LIBRARIES
${GSTREAMER_gstreamer_LIBRARY}
@ -95,7 +95,7 @@ if(NOT HAVE_GSTREAMER AND PKG_CONFIG_FOUND)
ocv_check_modules(GSTREAMER_video gstreamer-video-1.0)
if(GSTREAMER_base_FOUND AND GSTREAMER_app_FOUND AND GSTREAMER_riff_FOUND AND GSTREAMER_pbutils_FOUND AND GSTREAMER_video_FOUND)
set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_VERSION ${GSTREAMER_base_VERSION} PARENT_SCOPE) # informational
set(GSTREAMER_VERSION ${GSTREAMER_base_VERSION}) # informational
set(GSTREAMER_LIBRARIES ${GSTREAMER_base_LIBRARIES} ${GSTREAMER_app_LIBRARIES} ${GSTREAMER_riff_LIBRARIES} ${GSTREAMER_pbutils_LIBRARIES} ${GSTREAMER_video_LIBRARIES})
set(GSTREAMER_INCLUDE_DIRS ${GSTREAMER_base_INCLUDE_DIRS} ${GSTREAMER_app_INCLUDE_DIRS} ${GSTREAMER_riff_INCLUDE_DIRS} ${GSTREAMER_pbutils_INCLUDE_DIRS} ${GSTREAMER_video_INCLUDE_DIRS})
endif()
@ -104,5 +104,3 @@ endif()
if(HAVE_GSTREAMER)
ocv_add_external_target(gstreamer "${GSTREAMER_INCLUDE_DIRS}" "${GSTREAMER_LIBRARIES}" "HAVE_GSTREAMER")
endif()
set(HAVE_GSTREAMER ${HAVE_GSTREAMER} PARENT_SCOPE)

View File

@ -11,5 +11,3 @@ if(APPLE AND IOS)
"-framework UIKit")
ocv_add_external_target(cap_ios "" "${libs}" "HAVE_CAP_IOS")
endif()
set(HAVE_CAP_IOS ${HAVE_CAP_IOS} PARENT_SCOPE)

View File

@ -70,5 +70,3 @@ if(HAVE_MFX)
list(APPEND MFX_DEFS "HAVE_MFX")
ocv_add_external_target(mediasdk "${MFX_INCLUDE_DIRS}" "${MFX_LIBRARIES}" "${MFX_DEFS}")
endif()
set(HAVE_MFX ${HAVE_MFX} PARENT_SCOPE)

View File

@ -20,6 +20,3 @@ if(HAVE_MSMF)
endif()
ocv_add_external_target(msmf "" "" "${defs}")
endif()
set(HAVE_MSMF ${HAVE_MSMF} PARENT_SCOPE)
set(HAVE_MSMF_DXVA ${HAVE_MSMF_DXVA} PARENT_SCOPE)

View File

@ -42,8 +42,6 @@ if(HAVE_OPENNI2)
string(REGEX REPLACE ".*ONI_VERSION_MAJOR[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*ONI_VERSION_MINOR[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*ONI_VERSION_MAINTENANCE[^0-9]+([0-9]+).*" "\\1" ver_maint "${ver_strings}")
set(OPENNI2_VERSION "${ver_major}.${ver_minor}.${ver_maint}" PARENT_SCOPE) # informational
set(OPENNI2_VERSION "${ver_major}.${ver_minor}.${ver_maint}") # informational
ocv_add_external_target(openni2 "${OPENNI2_INCLUDE_DIRS}" "${OPENNI2_LIBRARIES}" "HAVE_OPENNI2")
endif()
set(HAVE_OPENNI2 ${HAVE_OPENNI2} PARENT_SCOPE)

View File

@ -19,5 +19,3 @@ endif()
if(HAVE_PVAPI)
ocv_add_external_target(pvapi "${PVAPI_INCLUDE}" "${PVAPI_LIBRARY}" "HAVE_PVAPI")
endif()
set(HAVE_PVAPI ${HAVE_PVAPI} PARENT_SCOPE)

View File

@ -4,7 +4,7 @@ if(NOT HAVE_LIBREALSENSE)
find_package(realsense2 QUIET)
if(realsense2_FOUND)
set(HAVE_LIBREALSENSE TRUE)
set(LIBREALSENSE_VERSION "${realsense2_VERSION}" PARENT_SCOPE) # informational
set(LIBREALSENSE_VERSION "${realsense2_VERSION}") # informational
ocv_add_external_target(librealsense "" "${realsense2_LIBRARY}" "HAVE_LIBREALSENSE")
endif()
endif()
@ -20,7 +20,7 @@ if(NOT HAVE_LIBREALSENSE)
string(REGEX REPLACE ".*RS2_API_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*RS2_API_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*RS2_API_PATCH_VERSION[^0-9]+([0-9]+).*" "\\1" ver_patch "${ver_strings}")
set(LIBREALSENSE_VERSION "${ver_major}.${ver_minor}.${ver_patch}" PARENT_SCOPE) # informational
set(LIBREALSENSE_VERSION "${ver_major}.${ver_minor}.${ver_patch}") # informational
ocv_add_external_target(librealsense "${LIBREALSENSE_INCLUDE_DIR}" "${LIBREALSENSE_LIBRARIES}" "HAVE_LIBREALSENSE")
endif()
endif()

View File

@ -21,5 +21,3 @@ unset(_WIN_LIB_SUFFIX)
if(HAVE_UEYE)
ocv_add_external_target(ueye "${UEYE_INCLUDE}" "${UEYE_LIBRARY}" "HAVE_UEYE")
endif()
set(HAVE_UEYE ${HAVE_UEYE} PARENT_SCOPE)

View File

@ -15,5 +15,3 @@ if(NOT HAVE_V4L)
ocv_add_external_target(v4l "" "" "${defs}")
endif()
endif()
set(HAVE_V4L ${HAVE_V4L} PARENT_SCOPE)

View File

@ -28,5 +28,3 @@ endif()
if(HAVE_XIMEA)
ocv_add_external_target(ximea "${XIMEA_INCLUDE}" "${XIMEA_LIBRARY}" "HAVE_XIMEA")
endif()
set(HAVE_XIMEA ${HAVE_XIMEA} PARENT_SCOPE)

View File

@ -5,5 +5,3 @@ endif()
if(HAVE_XINE)
ocv_add_external_target(xine "${XINE_INCLUDE_DIRS}" "${XINE_LIBRARIES}" "HAVE_XINE")
endif()
set(HAVE_XINE ${HAVE_XINE} PARENT_SCOPE)

View File

@ -1,19 +1,10 @@
include(FindPkgConfig)
# FIXIT: stop using PARENT_SCOPE in dependencies
if(PROJECT_NAME STREQUAL "OpenCV")
macro(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endmacro()
else()
function(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endfunction()
endif()
macro(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endmacro()
add_backend("ffmpeg" WITH_FFMPEG)
add_backend("gstreamer" WITH_GSTREAMER)