1 | # ===================================================================================
|
---|
2 | # The OpenCV CMake configuration file
|
---|
3 | #
|
---|
4 | # ** File generated automatically, do not modify **
|
---|
5 | #
|
---|
6 | # Usage from an external project:
|
---|
7 | # In your CMakeLists.txt, add these lines:
|
---|
8 | #
|
---|
9 | # FIND_PACKAGE(OpenCV REQUIRED)
|
---|
10 | # TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
|
---|
11 | #
|
---|
12 | # Or you can search for specific OpenCV modules:
|
---|
13 | #
|
---|
14 | # FIND_PACKAGE(OpenCV REQUIRED core highgui)
|
---|
15 | #
|
---|
16 | # If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE.
|
---|
17 | #
|
---|
18 | # This file will define the following variables:
|
---|
19 | # - OpenCV_LIBS : The list of all imported targets for OpenCV modules.
|
---|
20 | # - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
|
---|
21 | # - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability.
|
---|
22 | # - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
|
---|
23 | # - OpenCV_VERSION : The version of this OpenCV build: "2.4.9"
|
---|
24 | # - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "2"
|
---|
25 | # - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "4"
|
---|
26 | # - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION: "9"
|
---|
27 | # - OpenCV_VERSION_TWEAK : Tweak version part of OpenCV_VERSION: "0"
|
---|
28 | #
|
---|
29 | # Advanced variables:
|
---|
30 | # - OpenCV_SHARED : Use OpenCV as shared library
|
---|
31 | # - OpenCV_CONFIG_PATH : Path to this OpenCVConfig.cmake
|
---|
32 | # - OpenCV_INSTALL_PATH : OpenCV location (not set on Windows)
|
---|
33 | # - OpenCV_LIB_COMPONENTS : Present OpenCV modules list
|
---|
34 | # - OpenCV_USE_MANGLED_PATHS : Mangled OpenCV path flag
|
---|
35 | # - OpenCV_MODULES_SUFFIX : The suffix for OpenCVModules-XXX.cmake file
|
---|
36 | # - OpenCV_HAVE_ANDROID_CAMERA : Presence of Android native camera wrappers
|
---|
37 | #
|
---|
38 | # ===================================================================================
|
---|
39 |
|
---|
40 | if(NOT DEFINED OpenCV_MODULES_SUFFIX)
|
---|
41 | if(ANDROID)
|
---|
42 | string(REPLACE - _ OpenCV_MODULES_SUFFIX "_${ANDROID_NDK_ABI_NAME}")
|
---|
43 | else()
|
---|
44 | set(OpenCV_MODULES_SUFFIX "")
|
---|
45 | endif()
|
---|
46 | endif()
|
---|
47 |
|
---|
48 | if(NOT TARGET opencv_core)
|
---|
49 | include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${OpenCV_MODULES_SUFFIX}.cmake)
|
---|
50 | endif()
|
---|
51 |
|
---|
52 | # TODO All things below should be reviewed. What is about of moving this code into related modules (special vars/hooks/files)
|
---|
53 |
|
---|
54 | # Version Compute Capability from which OpenCV has been compiled is remembered
|
---|
55 | set(OpenCV_COMPUTE_CAPABILITIES "")
|
---|
56 |
|
---|
57 | set(OpenCV_CUDA_VERSION )
|
---|
58 | set(OpenCV_USE_CUBLAS )
|
---|
59 | set(OpenCV_USE_CUFFT )
|
---|
60 | set(OpenCV_USE_NVCUVID )
|
---|
61 |
|
---|
62 | # Android API level from which OpenCV has been compiled is remembered
|
---|
63 | set(OpenCV_ANDROID_NATIVE_API_LEVEL 0)
|
---|
64 |
|
---|
65 | # Some additional settings are required if OpenCV is built as static libs
|
---|
66 | set(OpenCV_SHARED ON)
|
---|
67 |
|
---|
68 | # Enables mangled install paths, that help with side by side installs
|
---|
69 | set(OpenCV_USE_MANGLED_PATHS FALSE)
|
---|
70 |
|
---|
71 | # Extract the directory where *this* file has been installed (determined at cmake run-time)
|
---|
72 | get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
|
---|
73 |
|
---|
74 | if(NOT WIN32 OR OpenCV_ANDROID_NATIVE_API_LEVEL GREATER 0)
|
---|
75 | if(OpenCV_ANDROID_NATIVE_API_LEVEL GREATER 0)
|
---|
76 | set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../../..")
|
---|
77 | else()
|
---|
78 | set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../..")
|
---|
79 | endif()
|
---|
80 | # Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
|
---|
81 | if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8)
|
---|
82 | get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_INSTALL_PATH}" ABSOLUTE)
|
---|
83 | else()
|
---|
84 | get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_INSTALL_PATH}" REALPATH)
|
---|
85 | endif()
|
---|
86 | endif()
|
---|
87 |
|
---|
88 | # Presence of Android native camera wrappers
|
---|
89 | set(OpenCV_HAVE_ANDROID_CAMERA OFF)
|
---|
90 |
|
---|
91 | # ======================================================
|
---|
92 | # Include directories to add to the user project:
|
---|
93 | # ======================================================
|
---|
94 |
|
---|
95 | # Provide the include directories to the caller
|
---|
96 | set(OpenCV_INCLUDE_DIRS "${OpenCV_CONFIG_PATH}/include" "${OpenCV_CONFIG_PATH}/include/opencv")
|
---|
97 | include_directories(${OpenCV_INCLUDE_DIRS})
|
---|
98 |
|
---|
99 | # ======================================================
|
---|
100 | # Link directories to add to the user project:
|
---|
101 | # ======================================================
|
---|
102 |
|
---|
103 | # Provide the libs directories to the caller
|
---|
104 | set(OpenCV_LIB_DIR_OPT CACHE PATH "Path where release OpenCV libraries are located")
|
---|
105 | set(OpenCV_LIB_DIR_DBG CACHE PATH "Path where debug OpenCV libraries are located")
|
---|
106 | set(OpenCV_3RDPARTY_LIB_DIR_OPT CACHE PATH "Path where release 3rdpaty OpenCV dependencies are located")
|
---|
107 | set(OpenCV_3RDPARTY_LIB_DIR_DBG CACHE PATH "Path where debug 3rdpaty OpenCV dependencies are located")
|
---|
108 | mark_as_advanced(FORCE OpenCV_LIB_DIR_OPT OpenCV_LIB_DIR_DBG OpenCV_3RDPARTY_LIB_DIR_OPT OpenCV_3RDPARTY_LIB_DIR_DBG OpenCV_CONFIG_PATH)
|
---|
109 |
|
---|
110 | # ======================================================
|
---|
111 | # Version variables:
|
---|
112 | # ======================================================
|
---|
113 | SET(OpenCV_VERSION 2.4.9)
|
---|
114 | SET(OpenCV_VERSION_MAJOR 2)
|
---|
115 | SET(OpenCV_VERSION_MINOR 4)
|
---|
116 | SET(OpenCV_VERSION_PATCH 9)
|
---|
117 | SET(OpenCV_VERSION_TWEAK 0)
|
---|
118 |
|
---|
119 | # ====================================================================
|
---|
120 | # Link libraries: e.g. opencv_core;opencv_imgproc; etc...
|
---|
121 | # ====================================================================
|
---|
122 |
|
---|
123 | SET(OpenCV_LIB_COMPONENTS opencv_videostab;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_photo;opencv_ocl;opencv_objdetect;opencv_nonfree;opencv_ml;opencv_legacy;opencv_imgproc;opencv_highgui;opencv_gpu;opencv_flann;opencv_features2d;opencv_core;opencv_contrib;opencv_calib3d)
|
---|
124 |
|
---|
125 | # ==============================================================
|
---|
126 | # Extra include directories, needed by OpenCV 2 new structure
|
---|
127 | # ==============================================================
|
---|
128 | SET(OpenCV2_INCLUDE_DIRS "")
|
---|
129 | if(OpenCV2_INCLUDE_DIRS)
|
---|
130 | include_directories(${OpenCV2_INCLUDE_DIRS})
|
---|
131 | list(APPEND OpenCV_INCLUDE_DIRS ${OpenCV2_INCLUDE_DIRS})
|
---|
132 |
|
---|
133 | set(OpenCV_ADD_DEBUG_RELEASE TRUE)
|
---|
134 | if(OpenCV_ADD_DEBUG_RELEASE)
|
---|
135 | set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_DIR_OPT}/Release")
|
---|
136 | set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_DIR_DBG}/Debug")
|
---|
137 | set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_3RDPARTY_LIB_DIR_OPT}/Release")
|
---|
138 | set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_3RDPARTY_LIB_DIR_DBG}/Debug")
|
---|
139 | endif()
|
---|
140 | endif()
|
---|
141 |
|
---|
142 | # ==============================================================
|
---|
143 | # Check OpenCV availability
|
---|
144 | # ==============================================================
|
---|
145 | if(ANDROID AND OpenCV_ANDROID_NATIVE_API_LEVEL GREATER ANDROID_NATIVE_API_LEVEL)
|
---|
146 | message(FATAL_ERROR "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
|
---|
147 | #always FATAL_ERROR because we can't say to the caller that OpenCV is not found
|
---|
148 | #http://www.mail-archive.com/cmake@cmake.org/msg37831.html
|
---|
149 | if(OpenCV_FIND_REQUIRED)
|
---|
150 | message(FATAL_ERROR "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
|
---|
151 | elseif(NOT OpenCV_FIND_QUIETLY)
|
---|
152 | message(WARNING "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
|
---|
153 | endif()
|
---|
154 | set(OpenCV_FOUND "OpenCV_FOUND-NOTFOUND")
|
---|
155 | return()#Android toolchain requires CMake > 2.6
|
---|
156 | endif()
|
---|
157 |
|
---|
158 | # ==============================================================
|
---|
159 | # Form list of modules (components) to find
|
---|
160 | # ==============================================================
|
---|
161 | if(NOT OpenCV_FIND_COMPONENTS)
|
---|
162 | set(OpenCV_FIND_COMPONENTS ${OpenCV_LIB_COMPONENTS})
|
---|
163 | list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_java)
|
---|
164 | if(GTest_FOUND OR GTEST_FOUND)
|
---|
165 | list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_ts)
|
---|
166 | endif()
|
---|
167 | endif()
|
---|
168 |
|
---|
169 | # expand short module names and see if requested components exist
|
---|
170 | set(OpenCV_FIND_COMPONENTS_ "")
|
---|
171 | foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
|
---|
172 | if(NOT __cvcomponent MATCHES "^opencv_")
|
---|
173 | set(__cvcomponent opencv_${__cvcomponent})
|
---|
174 | endif()
|
---|
175 | list(FIND OpenCV_LIB_COMPONENTS ${__cvcomponent} __cvcomponentIdx)
|
---|
176 | if(__cvcomponentIdx LESS 0)
|
---|
177 | #requested component is not found...
|
---|
178 | if(OpenCV_FIND_REQUIRED)
|
---|
179 | message(FATAL_ERROR "${__cvcomponent} is required but was not found")
|
---|
180 | elseif(NOT OpenCV_FIND_QUIETLY)
|
---|
181 | message(WARNING "${__cvcomponent} is required but was not found")
|
---|
182 | endif()
|
---|
183 | #indicate that module is NOT found
|
---|
184 | string(TOUPPER "${__cvcomponent}" __cvcomponent)
|
---|
185 | set(${__cvcomponent}_FOUND "${__cvcomponent}_FOUND-NOTFOUND")
|
---|
186 | else()
|
---|
187 | list(APPEND OpenCV_FIND_COMPONENTS_ ${__cvcomponent})
|
---|
188 | # Not using list(APPEND) here, because OpenCV_LIBS may not exist yet.
|
---|
189 | # Also not clearing OpenCV_LIBS anywhere, so that multiple calls
|
---|
190 | # to find_package(OpenCV) with different component lists add up.
|
---|
191 | set(OpenCV_LIBS ${OpenCV_LIBS} "${__cvcomponent}")
|
---|
192 | #indicate that module is found
|
---|
193 | string(TOUPPER "${__cvcomponent}" __cvcomponent)
|
---|
194 | set(${__cvcomponent}_FOUND 1)
|
---|
195 | endif()
|
---|
196 | endforeach()
|
---|
197 | set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_})
|
---|
198 |
|
---|
199 | # ==============================================================
|
---|
200 | # Resolve dependencies
|
---|
201 | # ==============================================================
|
---|
202 | if(OpenCV_USE_MANGLED_PATHS)
|
---|
203 | set(OpenCV_LIB_SUFFIX ".${OpenCV_VERSION_MAJOR}.${OpenCV_VERSION_MINOR}.${OpenCV_VERSION_PATCH}")
|
---|
204 | else()
|
---|
205 | set(OpenCV_LIB_SUFFIX "")
|
---|
206 | endif()
|
---|
207 |
|
---|
208 | foreach(__opttype OPT DBG)
|
---|
209 | SET(OpenCV_LIBS_${__opttype} "${OpenCV_LIBS}")
|
---|
210 | SET(OpenCV_EXTRA_LIBS_${__opttype} "")
|
---|
211 |
|
---|
212 | # CUDA
|
---|
213 | if(OpenCV_CUDA_VERSION)
|
---|
214 | if(NOT CUDA_FOUND)
|
---|
215 | find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
|
---|
216 | else()
|
---|
217 | if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
|
---|
218 | message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
|
---|
219 | endif()
|
---|
220 | endif()
|
---|
221 |
|
---|
222 | set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
|
---|
223 |
|
---|
224 | if(${CUDA_VERSION} VERSION_LESS "5.5")
|
---|
225 | list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
|
---|
226 | else()
|
---|
227 | find_cuda_helper_libs(nppc)
|
---|
228 | find_cuda_helper_libs(nppi)
|
---|
229 | find_cuda_helper_libs(npps)
|
---|
230 | list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
|
---|
231 | endif()
|
---|
232 |
|
---|
233 | if(OpenCV_USE_CUBLAS)
|
---|
234 | list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
|
---|
235 | endif()
|
---|
236 |
|
---|
237 | if(OpenCV_USE_CUFFT)
|
---|
238 | list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
|
---|
239 | endif()
|
---|
240 |
|
---|
241 | if(OpenCV_USE_NVCUVID)
|
---|
242 | list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
|
---|
243 | endif()
|
---|
244 |
|
---|
245 | if(WIN32)
|
---|
246 | list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
|
---|
247 | endif()
|
---|
248 |
|
---|
249 | set(OpenCV_CUDA_LIBS_RELPATH "")
|
---|
250 | foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
|
---|
251 | get_filename_component(_tmp ${l} PATH)
|
---|
252 | list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp})
|
---|
253 | endforeach()
|
---|
254 |
|
---|
255 | list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH)
|
---|
256 | link_directories(${OpenCV_CUDA_LIBS_RELPATH})
|
---|
257 | endif()
|
---|
258 | endforeach()
|
---|
259 |
|
---|
260 | # ==============================================================
|
---|
261 | # Android camera helper macro
|
---|
262 | # ==============================================================
|
---|
263 | if(OpenCV_HAVE_ANDROID_CAMERA)
|
---|
264 | macro(COPY_NATIVE_CAMERA_LIBS target)
|
---|
265 | get_target_property(target_location ${target} LOCATION)
|
---|
266 | get_filename_component(target_location "${target_location}" PATH)
|
---|
267 | file(GLOB camera_wrappers "${OpenCV_LIB_DIR_OPT}/libnative_camera_r*.so")
|
---|
268 | foreach(wrapper ${camera_wrappers})
|
---|
269 | add_custom_command(
|
---|
270 | TARGET ${target}
|
---|
271 | POST_BUILD
|
---|
272 | COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}"
|
---|
273 | )
|
---|
274 | endforeach()
|
---|
275 | endmacro()
|
---|
276 | endif()
|
---|
277 |
|
---|
278 | # ==============================================================
|
---|
279 | # Compatibility stuff
|
---|
280 | # ==============================================================
|
---|
281 | if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
---|
282 | SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_DBG} ${OpenCV_3RDPARTY_LIB_DIR_DBG})
|
---|
283 | else()
|
---|
284 | SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_OPT} ${OpenCV_3RDPARTY_LIB_DIR_OPT})
|
---|
285 | endif()
|
---|
286 | set(OpenCV_LIBRARIES ${OpenCV_LIBS})
|
---|
287 |
|
---|
288 | if(CMAKE_CROSSCOMPILING AND OpenCV_SHARED AND (CMAKE_SYSTEM_NAME MATCHES "Linux"))
|
---|
289 | foreach(dir ${OpenCV_LIB_DIR})
|
---|
290 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
|
---|
291 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
|
---|
292 | set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
|
---|
293 | endforeach()
|
---|
294 | endif()
|
---|
295 |
|
---|
296 |
|
---|
297 |
|
---|
298 | #
|
---|
299 | # Some macroses for samples
|
---|
300 | #
|
---|
301 | macro(ocv_check_dependencies)
|
---|
302 | set(OCV_DEPENDENCIES_FOUND TRUE)
|
---|
303 | foreach(d ${ARGN})
|
---|
304 | if(NOT TARGET ${d})
|
---|
305 | set(OCV_DEPENDENCIES_FOUND FALSE)
|
---|
306 | break()
|
---|
307 | endif()
|
---|
308 | endforeach()
|
---|
309 | endmacro()
|
---|
310 |
|
---|
311 | # adds include directories in such way that directories from the OpenCV source tree go first
|
---|
312 | function(ocv_include_directories)
|
---|
313 | set(__add_before "")
|
---|
314 | file(TO_CMAKE_PATH "${OpenCV_DIR}" __baseDir)
|
---|
315 | foreach(dir ${ARGN})
|
---|
316 | get_filename_component(__abs_dir "${dir}" ABSOLUTE)
|
---|
317 | if("${__abs_dir}" MATCHES "^${__baseDir}")
|
---|
318 | list(APPEND __add_before "${dir}")
|
---|
319 | else()
|
---|
320 | include_directories(AFTER SYSTEM "${dir}")
|
---|
321 | endif()
|
---|
322 | endforeach()
|
---|
323 | include_directories(BEFORE ${__add_before})
|
---|
324 | endfunction()
|
---|
325 |
|
---|
326 | macro(ocv_include_modules)
|
---|
327 | include_directories(BEFORE "${OpenCV_INCLUDE_DIRS}")
|
---|
328 | endmacro()
|
---|
329 |
|
---|
330 | # remove all matching elements from the list
|
---|
331 | macro(ocv_list_filterout lst regex)
|
---|
332 | foreach(item ${${lst}})
|
---|
333 | if(item MATCHES "${regex}")
|
---|
334 | list(REMOVE_ITEM ${lst} "${item}")
|
---|
335 | endif()
|
---|
336 | endforeach()
|
---|
337 | endmacro()
|
---|