1 #########################################################################
2 # Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Sets the following variables:
23 # OpenCV_FOUND - found flag
24 # OpenCV_INCLUDE_DIRS - path to the OpenCV include directories
25 # OpenCV_LIBS - path to the OpenCV libraries to be linked against
28 IF(NOT OpenCV_FIND_QUIETLY)
29 MESSAGE(STATUS "Check for OpenCV ...")
32 FIND_PATH(OpenCV_INCLUDE_DIRS cv.h PATH_SUFFIXES opencv)
33 IF(OpenCV_INCLUDE_DIRS)
34 SET(_OpenCV_INCLUDE_DIR_TMP "${OpenCV_INCLUDE_DIRS}/../opencv2")
35 GET_FILENAME_COMPONENT(_OpenCV_INCLUDE_DIR_TMP "${_OpenCV_INCLUDE_DIR_TMP}" REALPATH)
36 LIST(APPEND OpenCV_INCLUDE_DIRS ${_OpenCV_INCLUDE_DIR_TMP})
39 SET(OpenCV_LIB_COMPONENTS videostab;video;ts;superres;stitching;photo;ocl;objdetect;ml;legacy;imgproc;highgui;gpu;flann;features2d;core;objdetect;imgcodecs;shape)
41 FOREACH(_compo ${OpenCV_LIB_COMPONENTS})
42 FIND_LIBRARY(OpenCV_${_compo} opencv_${_compo})
44 LIST(APPEND OpenCV_LIBRARIES ${OpenCV_${_compo}})
47 IF(OpenCV_LIBRARIES AND OpenCV_INCLUDE_DIRS)
49 SET(OpenCV_LIBS ${OpenCV_LIBRARIES})
53 IF(NOT OpenCV_FIND_QUIETLY)
54 MESSAGE("OpenCV found !")
57 IF(NOT OpenCV_FIND_QUIETLY)
58 MESSAGE("Could not find OpenCV ...")