Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to compile opencv project in cmake

Hello,

I am working on Windows and I have already compiled opencv 3.2 in cmake on MS Visual Studio 2010. Now I want to make a test a create small project example. But I don"t know how should look like CMakeLists. I want to compile OpenCv example code in *.cpp file with cmake.

Could anyone help me please ?

  cmake_minimum_required(VERSION 2.8) 

PROJECT (TestOpenCV)
find_package(OpenCV REQUIRED)

add_executable(test1 test1.cpp)
target_link_libraries(test1 OpenCV ${OpenCV_LIBS})

link_directories(${OpenCV_LIB_DIR})

I got an link error concerning OpenCV.lib ?

I think that it is missing something in this script.

I would be appreciate for any help please