|
| 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_INCLUDE_DIRS : The OpenCV include directories. |
| 21 | +# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability |
| 22 | +# - OpenCV_VERSION : The version of this OpenCV build: "4.1.1" |
| 23 | +# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "4" |
| 24 | +# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "1" |
| 25 | +# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION: "1" |
| 26 | +# - OpenCV_VERSION_STATUS : Development status of this build: "" |
| 27 | +# |
| 28 | +# Advanced variables: |
| 29 | +# - OpenCV_SHARED |
| 30 | +# |
| 31 | +# =================================================================================== |
| 32 | +# |
| 33 | +# Windows pack specific options: |
| 34 | +# - OpenCV_STATIC |
| 35 | +# - OpenCV_CUDA |
| 36 | + |
| 37 | +if(CMAKE_VERSION VERSION_GREATER 2.6) |
| 38 | + get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) |
| 39 | + if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;") |
| 40 | + enable_language(CXX) |
| 41 | + endif() |
| 42 | +endif() |
| 43 | + |
| 44 | +if(NOT DEFINED OpenCV_STATIC) |
| 45 | + # look for global setting |
| 46 | + if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) |
| 47 | + set(OpenCV_STATIC OFF) |
| 48 | + else() |
| 49 | + set(OpenCV_STATIC ON) |
| 50 | + endif() |
| 51 | +endif() |
| 52 | + |
| 53 | +if(NOT DEFINED OpenCV_CUDA) |
| 54 | + # if user' app uses CUDA, then it probably wants CUDA-enabled OpenCV binaries |
| 55 | + if(CUDA_FOUND) |
| 56 | + set(OpenCV_CUDA ON) |
| 57 | + endif() |
| 58 | +endif() |
| 59 | + |
| 60 | +function(check_one_config RES) |
| 61 | + set(${RES} "" PARENT_SCOPE) |
| 62 | + if(NOT OpenCV_RUNTIME OR NOT OpenCV_ARCH) |
| 63 | + return() |
| 64 | + endif() |
| 65 | + set(candidates) |
| 66 | + if(OpenCV_STATIC) |
| 67 | + list(APPEND candidates "${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib") |
| 68 | + endif() |
| 69 | + if(OpenCV_CUDA) |
| 70 | + list(APPEND candidates "gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib") |
| 71 | + endif() |
| 72 | + if(OpenCV_CUDA AND OpenCV_STATIC) |
| 73 | + list(APPEND candidates "gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib") |
| 74 | + endif() |
| 75 | + list(APPEND candidates "${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib") |
| 76 | + foreach(c ${candidates}) |
| 77 | + set(p "${OpenCV_CONFIG_PATH}/${c}") |
| 78 | + if(EXISTS "${p}/OpenCVConfig.cmake") |
| 79 | + set(${RES} "${p}" PARENT_SCOPE) |
| 80 | + return() |
| 81 | + endif() |
| 82 | + endforeach() |
| 83 | +endfunction() |
| 84 | + |
| 85 | +get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) |
| 86 | + |
| 87 | +if(DEFINED OpenCV_ARCH AND DEFINED OpenCV_RUNTIME) |
| 88 | + # custom overridden values |
| 89 | +elseif(MSVC) |
| 90 | + if(CMAKE_CL_64) |
| 91 | + set(OpenCV_ARCH x64) |
| 92 | + elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm")) |
| 93 | + # see Modules/CmakeGenericSystem.cmake |
| 94 | + set(OpenCV_ARCH ARM) |
| 95 | + else() |
| 96 | + set(OpenCV_ARCH x86) |
| 97 | + endif() |
| 98 | + if(MSVC_VERSION EQUAL 1400) |
| 99 | + set(OpenCV_RUNTIME vc8) |
| 100 | + elseif(MSVC_VERSION EQUAL 1500) |
| 101 | + set(OpenCV_RUNTIME vc9) |
| 102 | + elseif(MSVC_VERSION EQUAL 1600) |
| 103 | + set(OpenCV_RUNTIME vc10) |
| 104 | + elseif(MSVC_VERSION EQUAL 1700) |
| 105 | + set(OpenCV_RUNTIME vc11) |
| 106 | + elseif(MSVC_VERSION EQUAL 1800) |
| 107 | + set(OpenCV_RUNTIME vc12) |
| 108 | + elseif(MSVC_VERSION EQUAL 1900) |
| 109 | + set(OpenCV_RUNTIME vc14) |
| 110 | + elseif(MSVC_VERSION MATCHES "^191[0-9]$") |
| 111 | + set(OpenCV_RUNTIME vc15) |
| 112 | + check_one_config(has_VS2017) |
| 113 | + if(NOT has_VS2017) |
| 114 | + set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version |
| 115 | + endif() |
| 116 | + elseif(MSVC_VERSION MATCHES "^192[0-9]$") |
| 117 | + set(OpenCV_RUNTIME vc16) |
| 118 | + check_one_config(has_VS2019) |
| 119 | + if(NOT has_VS2019) |
| 120 | + set(OpenCV_RUNTIME vc15) # selecting previous compatible runtime version |
| 121 | + check_one_config(has_VS2017) |
| 122 | + if(NOT has_VS2017) |
| 123 | + set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version |
| 124 | + endif() |
| 125 | + endif() |
| 126 | + endif() |
| 127 | +elseif(MINGW) |
| 128 | + set(OpenCV_RUNTIME mingw) |
| 129 | + |
| 130 | + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine |
| 131 | + OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE |
| 132 | + OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 133 | + if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64") |
| 134 | + set(MINGW64 1) |
| 135 | + set(OpenCV_ARCH x64) |
| 136 | + else() |
| 137 | + set(OpenCV_ARCH x86) |
| 138 | + endif() |
| 139 | +endif() |
| 140 | + |
| 141 | +check_one_config(OpenCV_LIB_PATH) |
| 142 | + |
| 143 | +if(NOT OpenCV_FIND_QUIETLY) |
| 144 | + message(STATUS "OpenCV ARCH: ${OpenCV_ARCH}") |
| 145 | + message(STATUS "OpenCV RUNTIME: ${OpenCV_RUNTIME}") |
| 146 | + message(STATUS "OpenCV STATIC: ${OpenCV_STATIC}") |
| 147 | +endif() |
| 148 | + |
| 149 | +if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake") |
| 150 | + include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake") |
| 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) |
| 172 | +endif() |
0 commit comments