1# Module for finding the core components of OpenCV installed by 2# graphics/opencv-core. Use for projects that require only 3# opencv_core or opencv_imgproc. Others should use the 4# standard OpenCV CMake find routines provided by graphics/opencv. 5# 6# This module provides: 7# OPENCVCORE_FOUND - defined if the required OpenCV components are found 8# OpenCV_INCLUDE_DIRS - the path to the OpenCV headers 9# OpenCV_LIBS - the OpenCV libraries to link to 10# OpenCV_VERSION - the version of OpenCV 11# 12# Example usage: find_package( OpenCVCore COMPONENTS core imgproc REQUIRED ) 13 14include( FindPackageHandleStandardArgs ) 15 16set( OpenCV_VERSION %%OCV_VERSION%% ) 17 18find_path( OpenCV_INCLUDE_DIRS NAMES opencv2/core/core.hpp ) 19 20if( OpenCVCore_FIND_COMPONENTS ) 21 foreach( component ${OpenCVCore_FIND_COMPONENTS} ) 22 string( TOUPPER ${component} _COMPONENT ) 23 set( OPENCV_USE_${_COMPONENT} 1 ) 24 endforeach() 25endif() 26 27# opencv_core is always required 28find_library( OPENCV_CORE_LIBRARY NAMES opencv_core ) 29 30if( OPENCV_USE_IMGPROC OR NOT OpenCVCore_FIND_COMPONENTS ) 31 find_library( OPENCV_IMGPROC_LIBRARY NAMES opencv_imgproc ) 32endif() 33 34set( OpenCV_LIBS ${OPENCV_CORE_LIBRARY} ${OPENCV_IMGPROC_LIBRARY} ) 35 36find_package_handle_standard_args( OpenCVCore DEFAULT_MSG OpenCV_LIBS OpenCV_INCLUDE_DIRS ) 37 38mark_as_advanced( ${OpenCV_LIBS} ${OpenCV_INCLUDE_DIRS} ${OpenCV_VERSION} ) 39