Commit 2c27e4f8 authored by Cédric Traizet's avatar Cédric Traizet

COMP: update findOpenCV.cmake for openCV 4

parent 5d475c21
Pipeline #2607 failed with stages
in 39 minutes and 49 seconds
......@@ -28,11 +28,11 @@ if(OpenCV_DIR)
if(OPENCV_SEARCH_PATH)
find_path(
opencv_INCLUDE_DIR
opencv/cv.h
opencv2/opencv.hpp
PATHS "${OPENCV_SEARCH_PATH}"
#no additional paths are added to the search if OpenCV_DIR
NO_DEFAULT_PATH
PATH_SUFFIXES "include"
PATH_SUFFIXES "include" "include/opencv4"
DOC "The directory where opencv/cv.h is installed")
endif()
endif()
......@@ -40,17 +40,12 @@ endif()
if(NOT opencv_INCLUDE_DIR)
find_path(
opencv_INCLUDE_DIR
opencv/cv.h
opencv2/opencv.hpp
PATHS "${OpenCV_DIR}"
PATH_SUFFIXES "include"
PATH_SUFFIXES "include" "include/opencv4"
DOC "The directory where opencv/cv.h is installed")
endif()
if(NOT EXISTS ${opencv_INCLUDE_DIR}/opencv2/opencv.hpp)
message(FATAL_ERROR "${opencv_INCLUDE_DIR}/opencv2/opencv.hpp does not exists. "
"Make sure you have opencv 2.3 or higher. We had searched in ${OPENCV_SEARCH_PATHS}")
endif()
set(opencv_core_NAMES opencv_core)
set(opencv_ml_NAMES opencv_ml)
......@@ -61,7 +56,7 @@ if (opencv_INCLUDE_DIR)
if(NOT OpenCV_VERSION)
file(READ "${opencv_INCLUDE_DIR}/opencv2/core/version.hpp" _header_content)
# detect the type of version file (2.3.x , 2.4.x or 3.x)
# detect the type of version file (2.3.x , 2.4.x, 3.x or 4.x)
string(REGEX MATCH ".*# *define +CV_VERSION_EPOCH +([0-9]+).*" has_epoch ${_header_content})
string(REGEX MATCH ".*# *define +CV_MAJOR_VERSION +([0-9]+).*" has_old_major ${_header_content})
string(REGEX MATCH ".*# *define +CV_MINOR_VERSION +([0-9]+).*" has_old_minor ${_header_content})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment