1 # cmake needs this line 2 cmake_minimum_required(VERSION 2.8) 3 4 # Define project name 5 project(opencv_example_project) 6 7 # Find OpenCV, you may need to set OpenCV_DIR variable 8 # to the absolute path to the directory containing OpenCVConfig.cmake file 9 # via the command line or GUI 10 find_package(OpenCV REQUIRED) 11 12 # If the package has been found, several variables will 13 # be set, you can find the full list with descriptions 14 # in the OpenCVConfig.cmake file. 15 # Print some message showing some of them 16 message(STATUS "OpenCV library status:") 17 message(STATUS " version: ${OpenCV_VERSION}") 18 message(STATUS " libraries: ${OpenCV_LIBS}") 19 message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 20 21 # Add OpenCV headers location to your include paths 22 include_directories(${OpenCV_INCLUDE_DIRS}) 23 24 # Declare the executable target built from your sources 25 add_executable(opencv_example example.cpp) 26 27 # Link your application with OpenCV libraries 28 target_link_libraries(opencv_example ${OpenCV_LIBS}) 29