Commit d1bf81f0 authored by Patrik Huber's avatar Patrik Huber

Merge pull request #5 from MichaelGrupp/master

Added OpenCV 3.0 compatibility to the examples with an if/else in CMakeLists
parents 3a39a178 25b85559
...@@ -2,7 +2,16 @@ project(examples) ...@@ -2,7 +2,16 @@ project(examples)
cmake_minimum_required(VERSION 2.8.10) cmake_minimum_required(VERSION 2.8.10)
# The examples need a few additional dependencies (e.g. boost filesystem and OpenCV highgui): # The examples need a few additional dependencies (e.g. boost filesystem and OpenCV highgui):
find_package(OpenCV 2.4.3 REQUIRED core imgproc highgui)
#check installed version in order to include the correct OpenCV libraries
#version variable is defined from project root's CMakeLists
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 imgcodecs)
endif()
message(STATUS "OpenCV include dir found at ${OpenCV_INCLUDE_DIRS}") message(STATUS "OpenCV include dir found at ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV lib dir found at ${OpenCV_LIB_DIR}") message(STATUS "OpenCV lib dir found at ${OpenCV_LIB_DIR}")
# This allows us to compile in RelWithDebInfo. It'll use the Release-version of OpenCV: # This allows us to compile in RelWithDebInfo. It'll use the Release-version of OpenCV:
......
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