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 imgcodecs) 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 libraries to link 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" 29 # 30 # Advanced variables: 31 # - OpenCV_SHARED 32 # - OpenCV_CONFIG_PATH 33 # - OpenCV_LIB_COMPONENTS 34 # 35 # =================================================================================== 36 # 37 # Windows pack specific options: 38 # - OpenCV_STATIC 39 # - OpenCV_CUDA 40 41 if(CMAKE_VERSION VERSION_GREATER 2.6) 42 get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) 43 if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;") 44 enable_language(CXX) 45 endif() 46 endif() 47 48 if(NOT DEFINED OpenCV_STATIC) 49 # look for global setting 50 if(BUILD_SHARED_LIBS) 51 set(OpenCV_STATIC OFF) 52 else() 53 set(OpenCV_STATIC ON) 54 endif() 55 endif() 56 57 if(NOT DEFINED OpenCV_CUDA) 58 # if user' app uses CUDA, then it probably wants CUDA-enabled OpenCV binaries 59 if(CUDA_FOUND) 60 set(OpenCV_CUDA ON) 61 endif() 62 endif() 63 64 if(MSVC) 65 if(CMAKE_CL_64) 66 set(OpenCV_ARCH x64) 67 set(OpenCV_TBB_ARCH intel64) 68 elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm")) 69 # see Modules/CmakeGenericSystem.cmake 70 set(OpenCV_ARCH ARM) 71 else() 72 set(OpenCV_ARCH x86) 73 set(OpenCV_TBB_ARCH ia32) 74 endif() 75 if(MSVC_VERSION EQUAL 1400) 76 set(OpenCV_RUNTIME vc8) 77 elseif(MSVC_VERSION EQUAL 1500) 78 set(OpenCV_RUNTIME vc9) 79 elseif(MSVC_VERSION EQUAL 1600) 80 set(OpenCV_RUNTIME vc10) 81 elseif(MSVC_VERSION EQUAL 1700) 82 set(OpenCV_RUNTIME vc11) 83 elseif(MSVC_VERSION EQUAL 1800) 84 set(OpenCV_RUNTIME vc12) 85 elseif(MSVC_VERSION EQUAL 1900) 86 set(OpenCV_RUNTIME vc14) 87 endif() 88 elseif(MINGW) 89 set(OpenCV_RUNTIME mingw) 90 91 execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine 92 OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE 93 OUTPUT_STRIP_TRAILING_WHITESPACE) 94 if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") 95 set(MINGW64 1) 96 set(OpenCV_ARCH x64) 97 else() 98 set(OpenCV_ARCH x86) 99 endif() 100 endif() 101 102 if(CMAKE_VERSION VERSION_GREATER 2.6.2) 103 unset(OpenCV_CONFIG_PATH CACHE) 104 endif() 105 106 if(NOT OpenCV_FIND_QUIETLY) 107 message(STATUS "OpenCV ARCH: ${OpenCV_ARCH}") 108 message(STATUS "OpenCV RUNTIME: ${OpenCV_RUNTIME}") 109 message(STATUS "OpenCV STATIC: ${OpenCV_STATIC}") 110 endif() 111 112 get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE) 113 if(OpenCV_RUNTIME AND OpenCV_ARCH) 114 if(OpenCV_STATIC AND EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake") 115 if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake") 116 set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib") 117 else() 118 set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib") 119 endif() 120 elseif(EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake") 121 if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake") 122 set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib") 123 else() 124 set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib") 125 endif() 126 endif() 127 endif() 128 129 if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake") 130 set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release OpenCV libraries are located" FORCE) 131 set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug OpenCV libraries are located" FORCE) 132 set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release 3rdparty OpenCV dependencies are located" FORCE) 133 set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug 3rdparty OpenCV dependencies are located" FORCE) 134 135 include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake") 136 137 if(OpenCV_CUDA) 138 set(_OpenCV_LIBS "") 139 foreach(_lib ${OpenCV_LIBS}) 140 string(REPLACE "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}" "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}" _lib2 "${_lib}") 141 if(NOT EXISTS "${_lib}" AND EXISTS "${_lib2}") 142 list(APPEND _OpenCV_LIBS "${_lib2}") 143 else() 144 list(APPEND _OpenCV_LIBS "${_lib}") 145 endif() 146 endforeach() 147 set(OpenCV_LIBS ${_OpenCV_LIBS}) 148 endif() 149 set(OpenCV_FOUND TRUE CACHE BOOL "" FORCE) 150 set(OPENCV_FOUND TRUE CACHE BOOL "" FORCE) 151 152 if(NOT OpenCV_FIND_QUIETLY) 153 message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}") 154 if(NOT OpenCV_LIB_PATH MATCHES "/staticlib") 155 get_filename_component(_OpenCV_LIB_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE) 156 file(TO_NATIVE_PATH "${_OpenCV_LIB_PATH}" _OpenCV_LIB_PATH) 157 message(STATUS "You might need to add ${_OpenCV_LIB_PATH} to your PATH to be able to run your applications.") 158 if(OpenCV_LIB_PATH MATCHES "/gpu/") 159 string(REPLACE "\\gpu" "" _OpenCV_LIB_PATH2 "${_OpenCV_LIB_PATH}") 160 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}).") 161 endif() 162 endif() 163 endif() 164 else() 165 if(NOT OpenCV_FIND_QUIETLY) 166 message(WARNING 167 "Found OpenCV Windows Pack but it has no binaries compatible with your configuration. 168 You should manually point CMake variable OpenCV_DIR to your build of OpenCV library." 169 ) 170 endif() 171 set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE) 172 set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE) 173 endif() 174