CMakeLists.txt 2.2 KB
Newer Older
1
set(the_description "All OpenCV modules")
2 3
set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
set(BUILD_opencv_world_INIT OFF)
4

5
if(NOT BUILD_SHARED_LIBS)
6 7 8 9
  set(OPENCV_MODULE_TYPE STATIC)
  set(OPENCV_WORLD_FLAGS_PROPERTY STATIC_LIBRARY_FLAGS)
else()
  set(OPENCV_WORLD_FLAGS_PROPERTY LINK_FLAGS)
10
endif()
11

M
Maksim Shabunin 已提交
12 13
function(include_one_module m)
  include("${OPENCV_MODULE_${m}_LOCATION}/CMakeLists.txt")
14 15 16 17 18
  foreach(var
      CMAKE_CXX_FLAGS CMAKE_C_FLAGS # Propagate warnings settings
  )
    set(${var} "${${var}}" PARENT_SCOPE)
  endforeach()
M
Maksim Shabunin 已提交
19 20
endfunction()

A
Alexander Alekhin 已提交
21
if(NOT OPENCV_INITIAL_PASS)
22
  set(ENABLE_PRECOMPILED_HEADERS OFF CACHE INTERNAL "" FORCE)
A
Alexander Alekhin 已提交
23 24 25 26
  project(opencv_world)

  message(STATUS "Processing WORLD modules...")
  foreach(m ${OPENCV_MODULES_BUILD})
27
    set(the_module ${m})
A
Alexander Alekhin 已提交
28 29
    if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD)
      message(STATUS "    module ${m}...")
30
      set(CMAKE_CURRENT_SOURCE_DIR "${OPENCV_MODULE_${m}_LOCATION}")
A
Alexander Alekhin 已提交
31
      #add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" ${CMAKE_CURRENT_BINARY_DIR}/${m})
M
Maksim Shabunin 已提交
32
      include_one_module(${m})
A
Alexander Alekhin 已提交
33
    endif()
34
  endforeach()
A
Alexander Alekhin 已提交
35
  message(STATUS "Processing WORLD modules... DONE")
36
  set(CMAKE_CURRENT_SOURCE_DIR "${OPENCV_MODULE_opencv_world_LOCATION}")
37 38
endif()

A
Alexander Alekhin 已提交
39
ocv_add_module(world opencv_core)
40

A
Alexander Alekhin 已提交
41 42 43
set(headers_list "HEADERS")
set(sources_list "SOURCES")
set(link_deps "")
44
foreach(m ${OPENCV_MODULE_${the_module}_DEPS} opencv_world)
45 46 47 48
  if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD)
    set(headers_list "${headers_list};${OPENCV_MODULE_${m}_HEADERS}")
    set(sources_list "${sources_list};${OPENCV_MODULE_${m}_SOURCES}")
  endif()
49 50 51
  if(NOT " ${OPENCV_MODULE_${m}_LINK_DEPS}" STREQUAL " ")
    list(APPEND link_deps ${OPENCV_MODULE_${m}_LINK_DEPS})
  endif()
52 53
endforeach()

A
Alexander Alekhin 已提交
54
ocv_glob_module_sources(${headers_list} ${sources_list})
A
Anatoly Baksheev 已提交
55

A
Alexander Alekhin 已提交
56
ocv_module_include_directories()
A
Anatoly Baksheev 已提交
57

A
Alexander Alekhin 已提交
58 59 60
#message(STATUS "${OPENCV_MODULE_${the_module}_HEADERS}")
#message(STATUS "${OPENCV_MODULE_${the_module}_SOURCES}")
ocv_create_module(${link_deps})
61

62
if(BUILD_opencv_imgcodecs AND OPENCV_MODULE_opencv_imgcodecs_IS_PART_OF_WORLD)
A
Alexander Alekhin 已提交
63
  ocv_imgcodecs_configure_target()
64
endif()
65
if(BUILD_opencv_videoio AND OPENCV_MODULE_opencv_videoio_IS_PART_OF_WORLD)
A
Alexander Alekhin 已提交
66
  ocv_videoio_configure_target()
67
endif()
68
if(BUILD_opencv_highgui AND OPENCV_MODULE_opencv_highgui_IS_PART_OF_WORLD)
A
Alexander Alekhin 已提交
69
  ocv_highgui_configure_target()
70
endif()