OpenCVConfig.root-WIN32.cmake.in 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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: "@OPENCV_VERSION_PLAIN@"
  23. # - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
  24. # - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "@OPENCV_VERSION_MINOR@"
  25. # - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION: "@OPENCV_VERSION_PATCH@"
  26. # - OpenCV_VERSION_STATUS : Development status of this build: "@OPENCV_VERSION_STATUS@"
  27. #
  28. # Advanced variables:
  29. # - OpenCV_SHARED
  30. #
  31. # ===================================================================================
  32. #
  33. # Windows pack specific options:
  34. # - OpenCV_STATIC
  35. # - OpenCV_CUDA
  36. if(CMAKE_VERSION VERSION_GREATER 2.6)
  37. get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
  38. if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;")
  39. enable_language(CXX)
  40. endif()
  41. endif()
  42. if(NOT DEFINED OpenCV_STATIC)
  43. # look for global setting
  44. if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
  45. set(OpenCV_STATIC OFF)
  46. else()
  47. set(OpenCV_STATIC ON)
  48. endif()
  49. endif()
  50. if(NOT DEFINED OpenCV_CUDA)
  51. # if user' app uses CUDA, then it probably wants CUDA-enabled OpenCV binaries
  52. if(CUDA_FOUND)
  53. set(OpenCV_CUDA ON)
  54. endif()
  55. endif()
  56. function(check_one_config RES)
  57. set(${RES} "" PARENT_SCOPE)
  58. if(NOT OpenCV_RUNTIME OR NOT OpenCV_ARCH)
  59. return()
  60. endif()
  61. set(candidates)
  62. if(OpenCV_STATIC)
  63. list(APPEND candidates "${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
  64. endif()
  65. if(OpenCV_CUDA)
  66. list(APPEND candidates "gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
  67. endif()
  68. if(OpenCV_CUDA AND OpenCV_STATIC)
  69. list(APPEND candidates "gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
  70. endif()
  71. list(APPEND candidates "${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
  72. foreach(c ${candidates})
  73. set(p "${OpenCV_CONFIG_PATH}/${c}")
  74. if(EXISTS "${p}/OpenCVConfig.cmake")
  75. set(${RES} "${p}" PARENT_SCOPE)
  76. return()
  77. endif()
  78. endforeach()
  79. endfunction()
  80. get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
  81. if((NOT DEFINED CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR STREQUAL "")
  82. AND NOT OPENCV_SUPPRESS_MESSAGE_MISSING_CMAKE_SYSTEM_PROCESSOR)
  83. message(WARNING "OpenCV: CMAKE_SYSTEM_PROCESSOR is not defined. Perhaps CMake toolchain is broken")
  84. endif()
  85. if(NOT DEFINED CMAKE_SIZEOF_VOID_P
  86. AND NOT OPENCV_SUPPRESS_MESSAGE_MISSING_CMAKE_SIZEOF_VOID_P)
  87. message(WARNING "OpenCV: CMAKE_SIZEOF_VOID_P is not defined. Perhaps CMake toolchain is broken")
  88. endif()
  89. if(DEFINED OpenCV_ARCH AND DEFINED OpenCV_RUNTIME)
  90. # custom overridden values
  91. elseif(MSVC)
  92. # see Modules/CMakeGenericSystem.cmake
  93. if("${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)")
  94. set(OpenCV_ARCH "x64")
  95. elseif("${CMAKE_GENERATOR_PLATFORM}" MATCHES "ARM64")
  96. set(OpenCV_ARCH "ARM64")
  97. elseif("${CMAKE_GENERATOR}" MATCHES "ARM")
  98. set(OpenCV_ARCH "ARM")
  99. elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
  100. set(OpenCV_ARCH "x64")
  101. else()
  102. set(OpenCV_ARCH x86)
  103. endif()
  104. if(MSVC_VERSION EQUAL 1400)
  105. set(OpenCV_RUNTIME vc8)
  106. elseif(MSVC_VERSION EQUAL 1500)
  107. set(OpenCV_RUNTIME vc9)
  108. elseif(MSVC_VERSION EQUAL 1600)
  109. set(OpenCV_RUNTIME vc10)
  110. elseif(MSVC_VERSION EQUAL 1700)
  111. set(OpenCV_RUNTIME vc11)
  112. elseif(MSVC_VERSION EQUAL 1800)
  113. set(OpenCV_RUNTIME vc12)
  114. elseif(MSVC_VERSION EQUAL 1900)
  115. set(OpenCV_RUNTIME vc14)
  116. elseif(MSVC_VERSION MATCHES "^191[0-9]$")
  117. set(OpenCV_RUNTIME vc15)
  118. check_one_config(has_VS2017)
  119. if(NOT has_VS2017)
  120. set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version
  121. endif()
  122. elseif(MSVC_VERSION MATCHES "^192[0-9]$")
  123. set(OpenCV_RUNTIME vc16)
  124. check_one_config(has_VS2019)
  125. if(NOT has_VS2019)
  126. set(OpenCV_RUNTIME vc15) # selecting previous compatible runtime version
  127. check_one_config(has_VS2017)
  128. if(NOT has_VS2017)
  129. set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version
  130. endif()
  131. endif()
  132. elseif(MSVC_VERSION MATCHES "^193[0-9]$")
  133. set(OpenCV_RUNTIME vc17)
  134. check_one_config(has_VS2022)
  135. if(NOT has_VS2022)
  136. set(OpenCV_RUNTIME vc16)
  137. check_one_config(has_VS2019)
  138. if(NOT has_VS2019)
  139. set(OpenCV_RUNTIME vc15) # selecting previous compatible runtime version
  140. check_one_config(has_VS2017)
  141. if(NOT has_VS2017)
  142. set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version
  143. endif()
  144. endif()
  145. endif()
  146. endif()
  147. elseif(MINGW)
  148. set(OpenCV_RUNTIME mingw)
  149. if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
  150. set(OpenCV_ARCH x64)
  151. else()
  152. set(OpenCV_ARCH x86)
  153. endif()
  154. endif()
  155. check_one_config(OpenCV_LIB_PATH)
  156. if(NOT OpenCV_FIND_QUIETLY)
  157. message(STATUS "OpenCV ARCH: ${OpenCV_ARCH}")
  158. message(STATUS "OpenCV RUNTIME: ${OpenCV_RUNTIME}")
  159. message(STATUS "OpenCV STATIC: ${OpenCV_STATIC}")
  160. endif()
  161. if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
  162. include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
  163. if(NOT OpenCV_FIND_QUIETLY)
  164. message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}")
  165. if(NOT OpenCV_LIB_PATH MATCHES "/staticlib")
  166. get_filename_component(_OpenCV_LIB_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE)
  167. file(TO_NATIVE_PATH "${_OpenCV_LIB_PATH}" _OpenCV_LIB_PATH)
  168. message(STATUS "You might need to add ${_OpenCV_LIB_PATH} to your PATH to be able to run your applications.")
  169. if(OpenCV_LIB_PATH MATCHES "/gpu/")
  170. string(REPLACE "\\gpu" "" _OpenCV_LIB_PATH2 "${_OpenCV_LIB_PATH}")
  171. 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}).")
  172. endif()
  173. endif()
  174. endif()
  175. else()
  176. if(NOT OpenCV_FIND_QUIETLY)
  177. message(WARNING
  178. "Found OpenCV Windows Pack but it has no binaries compatible with your configuration.
  179. You should manually point CMake variable OpenCV_DIR to your build of OpenCV library."
  180. )
  181. endif()
  182. set(OpenCV_FOUND FALSE)
  183. endif()