Commit 8c26b7d0 authored by MichaelGrupp's avatar MichaelGrupp

Include appropriate libraries for OpenCV 2.x or 3.x

imread has moved from highgui to the imgcodecs module in version 3.0.
parent ced2b602
......@@ -2,10 +2,12 @@ project(examples)
cmake_minimum_required(VERSION 2.8.10)
# The examples need a few additional dependencies (e.g. boost filesystem and OpenCV highgui):
find_package(OpenCV 2.4.3 REQUIRED core imgproc highgui)
if("${OpenCV_VERSION_MAJOR}$" EQUAL 3)
if("${OpenCV_VERSION_MAJOR}$" EQUAL 2)
message(STATUS "OpenCV 2.x detected")
find_package(OpenCV 2.4.3 REQUIRED core imgproc highgui)
elseif("${OpenCV_VERSION_MAJOR}$" EQUAL 3)
message(STATUS "OpenCV 3.x detected - including imgcodecs for compatibility")
find_package(OpenCV 3.0.0 REQUIRED core imgproc highgui imgcodecs)
find_package(OpenCV 3.0.0 REQUIRED core imgproc imgcodecs)
endif()
message(STATUS "OpenCV include dir found at ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV lib dir found at ${OpenCV_LIB_DIR}")
......
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