1. find_package(OpenCV 3 REQUIRED)
通过OpenCV_DIR变量寻找OpenCVConfig.cmake文件,默认在/usr/share/OpenCV中
set(OpenCV_DIR "***********************")指定find_package()搜索opencv路径,用于不同opencv版本切换。
2,OpenCVConfig.cmake
其中描述了cmakelist.txt中引用opencv的方式。
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS}) # Not needed for CMake >= 2.8.11
target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})
文件定义了很多关于cmakelist.txt中常用的变量
如:OpenCV_LIBS, OpenCV_INCLUDE_DIRS等
# ===================================================================================
# The OpenCV CMake configuration file
#
# ** File generated automatically, do not modify **
#
# Usage from an external project:
# In your CMakeLists.txt, add these lines:
#
# find_package(OpenCV REQUIRED)
# include_directories(${OpenCV_INCLUDE_DIRS}) # Not needed for CMake >= 2.8.11
# target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})
#
# Or you can search for specific OpenCV modules:
#
# find_package(OpenCV REQUIRED core videoio)
#
# You can also mark OpenCV components as optional:
# find_package(OpenCV REQUIRED core OPTIONAL_COMPONENTS viz)
#
# If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE.
#
# This file will define the following variables:
# - OpenCV_LIBS : The list of all imported targets for OpenCV modules.
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability.
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
# - OpenCV_VERSION : The version of this OpenCV build: "3.2.0"
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "3"
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "2"
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION: "0"
# - OpenCV_VERSION_STATUS : Development status of this build: ""
#
# Advanced variables:
# - OpenCV_SHARED : Use OpenCV as shared library
# - OpenCV_INSTALL_PATH : OpenCV location
# - OpenCV_LIB_COMPONENTS : Present OpenCV modules list
# - OpenCV_USE_MANGLED_PATHS : Mangled OpenCV path flag
#
# Deprecated variables:
# - OpenCV_VERSION_TWEAK : Always "0"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)