summaryrefslogtreecommitdiff
path: root/graphics/opencv/files/FindOpenCVCore.cmake.in
blob: ee278d78fcd6bb71b61798bcfeca61785e2233c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Module for finding the core components of OpenCV installed by
# graphics/opencv-core.  Use for projects that require only
# opencv_core or opencv_imgproc.  Others should use the
# standard OpenCV CMake find routines provided by graphics/opencv.
#
# This module provides:
# OPENCVCORE_FOUND - defined if the required OpenCV components are found
# OpenCV_INCLUDE_DIRS - the path to the OpenCV headers
# OpenCV_LIBS - the OpenCV libraries to link to
# OpenCV_VERSION - the version of OpenCV
#
# Example usage: find_package( OpenCVCore COMPONENTS core imgproc REQUIRED )

include( FindPackageHandleStandardArgs )

set( OpenCV_VERSION %%OCV_VERSION%% )

find_path( OpenCV_INCLUDE_DIRS NAMES opencv2/core/core.hpp )

if( OpenCVCore_FIND_COMPONENTS )
  foreach( component ${OpenCVCore_FIND_COMPONENTS} )
    string( TOUPPER ${component} _COMPONENT )
    set( OPENCV_USE_${_COMPONENT} 1 )
  endforeach()
endif()

# opencv_core is always required
find_library( OPENCV_CORE_LIBRARY NAMES opencv_core )

if( OPENCV_USE_IMGPROC OR NOT OpenCVCore_FIND_COMPONENTS )
  find_library( OPENCV_IMGPROC_LIBRARY NAMES opencv_imgproc )
endif()

set( OpenCV_LIBS ${OPENCV_CORE_LIBRARY} ${OPENCV_IMGPROC_LIBRARY} )

find_package_handle_standard_args( OpenCVCore DEFAULT_MSG OpenCV_LIBS OpenCV_INCLUDE_DIRS )

mark_as_advanced( ${OpenCV_LIBS} ${OpenCV_INCLUDE_DIRS} ${OpenCV_VERSION} )