1 # ===================================================================================
2 # The OpenCV CMake configuration file
4 # ** File generated automatically, do not modify **
6 # Usage from an external project:
7 # In your CMakeLists.txt, add these lines:
9 # FIND_PACKAGE(OpenCV REQUIRED)
10 # TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
12 # Or you can search for specific OpenCV modules:
14 # FIND_PACKAGE(OpenCV REQUIRED core highgui)
16 # If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE.
18 # This file will define the following variables:
19 # - OpenCV_LIBS : The list of libraries to links against.
20 # - OpenCV_LIB_DIR : The directory(es) where lib files are. Calling LINK_DIRECTORIES
21 # with this path is NOT needed.
22 # - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
23 # - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
24 # - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
25 # - OpenCV_VERSION : The version of this OpenCV build. Example: "2.4.0"
26 # - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "2"
27 # - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "4"
28 # - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
32 # - OpenCV_CONFIG_PATH
33 # - OpenCV_LIB_COMPONENTS
35 # ===================================================================================
37 # Windows pack specific options:
41 if(CMAKE_VERSION VERSION_GREATER 2.6)
42 get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
43 if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;")
48 if(NOT DEFINED OpenCV_STATIC)
49 # look for global setting
50 if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
51 set(OpenCV_STATIC OFF)
57 if(NOT DEFINED OpenCV_CUDA)
58 # if user' app uses CUDA, then it probably wants CUDA-enabled OpenCV binaries
67 set(OpenCV_TBB_ARCH intel64)
70 set(OpenCV_TBB_ARCH ia32)
72 if(MSVC_VERSION EQUAL 1400)
73 set(OpenCV_RUNTIME vc8)
74 elseif(MSVC_VERSION EQUAL 1500)
75 set(OpenCV_RUNTIME vc9)
76 elseif(MSVC_VERSION EQUAL 1600)
77 set(OpenCV_RUNTIME vc10)
78 elseif(MSVC_VERSION EQUAL 1700)
79 set(OpenCV_RUNTIME vc11)
82 set(OpenCV_RUNTIME mingw)
84 execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
85 OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
86 OUTPUT_STRIP_TRAILING_WHITESPACE)
87 if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
95 if(CMAKE_VERSION VERSION_GREATER 2.6.2)
96 unset(OpenCV_CONFIG_PATH CACHE)
99 if(NOT OpenCV_FIND_QUIETLY)
100 message(STATUS "OpenCV ARCH: ${OpenCV_ARCH}")
101 message(STATUS "OpenCV RUNTIME: ${OpenCV_RUNTIME}")
102 message(STATUS "OpenCV STATIC: ${OpenCV_STATIC}")
105 get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
106 if(OpenCV_RUNTIME AND OpenCV_ARCH)
107 if(OpenCV_STATIC AND EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
108 if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
109 set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
111 set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
113 elseif(EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake")
114 if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake")
115 set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
117 set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
122 if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
123 set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release OpenCV libraries are located" FORCE)
124 set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug OpenCV libraries are located" FORCE)
125 set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release 3rdpaty OpenCV dependencies are located" FORCE)
126 set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug 3rdpaty OpenCV dependencies are located" FORCE)
128 include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
132 foreach(_lib ${OpenCV_LIBS})
133 string(REPLACE "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}" "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}" _lib2 "${_lib}")
134 if(NOT EXISTS "${_lib}" AND EXISTS "${_lib2}")
135 list(APPEND _OpenCV_LIBS "${_lib2}")
137 list(APPEND _OpenCV_LIBS "${_lib}")
140 set(OpenCV_LIBS ${_OpenCV_LIBS})
142 set(OpenCV_FOUND TRUE CACHE BOOL "" FORCE)
143 set(OPENCV_FOUND TRUE CACHE BOOL "" FORCE)
145 if(NOT OpenCV_FIND_QUIETLY)
146 message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}")
147 if(NOT OpenCV_LIB_PATH MATCHES "/staticlib")
148 get_filename_component(_OpenCV_LIB_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE)
149 file(TO_NATIVE_PATH "${_OpenCV_LIB_PATH}" _OpenCV_LIB_PATH)
150 message(STATUS "You might need to add ${_OpenCV_LIB_PATH} to your PATH to be able to run your applications.")
151 if(OpenCV_LIB_PATH MATCHES "/gpu/")
152 string(REPLACE "\\gpu" "" _OpenCV_LIB_PATH2 "${_OpenCV_LIB_PATH}")
153 message(STATUS "GPU support is enabled so you might also need ${_OpenCV_LIB_PATH2} in your PATH (it must go after the ${_OpenCV_LIB_PATH}).")
158 if(NOT OpenCV_FIND_QUIETLY)
160 "Found OpenCV Windows Pack but it has not binaries compatible with your configuration.
161 You should manually point CMake variable OpenCV_DIR to your build of OpenCV library."
164 set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE)
165 set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE)
170 # Some macroses for samples
172 macro(ocv_check_dependencies)
173 set(OCV_DEPENDENCIES_FOUND TRUE)
176 set(OCV_DEPENDENCIES_FOUND FALSE)
182 # adds include directories in such way that directories from the OpenCV source tree go first
183 function(ocv_include_directories)
186 get_filename_component(__abs_dir "${dir}" ABSOLUTE)
187 if("${__abs_dir}" MATCHES "^${OpenCV_DIR}")
188 list(APPEND __add_before "${dir}")
190 include_directories(AFTER SYSTEM "${dir}")
193 include_directories(BEFORE ${__add_before})
196 macro(ocv_include_modules)
197 include_directories(BEFORE "${OpenCV_INCLUDE_DIRS}")
200 # remove all matching elements from the list
201 macro(ocv_list_filterout lst regex)
202 foreach(item ${${lst}})
203 if(item MATCHES "${regex}")
204 list(REMOVE_ITEM ${lst} "${item}")