dynamic
dynamic

Reputation: 48101

CMake how to set the correct inclusion path prefix on VC2010?

So basically i am using cmake to create project for visual studio 2010 with opencv.

I have followed this guide on windows 7 and all worked fine: http://redkiing.wordpress.com/2010/10/03/opencv-and-visual-studio-2010-with-cmake/

Then i have tried it with windows vista and cmake keeps creating the project with bad inclusion directory resulting in the error: C:\Program Files\OpenCV\include\opencv\cv.h(63): fatal error "opencv2/core/core_c.h" no such file or directory

Cmake instead to set the correct dir like this

C:\Program Files\OpenCV/modules/core/include
etc

It sets that directroy like this: (and they dont' exist):

C:\Program Files\myFirstOpenCVProject\Files/modules/core/include

I had to include manually all the correct path. Is there any way to tell cmake which are the correct path?

Cmake version 2.8.8

Edit

Cmake file i am using:

SET( PROJECT_NAME project_name_goes_here )
PROJECT( ${PROJECT_NAME} )
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
FIND_PACKAGE( OpenCV REQUIRED )
ADD_EXECUTABLE( ${PROJECT_NAME} main.cpp )
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS} )

Upvotes: 1

Views: 630

Answers (1)

alanxz
alanxz

Reputation: 2026

I'm not exactly sure how the FindOpenCV.cmake module is setup, but I think you need to add the line:

include_directories(${OpenCV_INCLUDE_DIR})

Before the add_executable line.

Edit: I assume you're using this FindOpenCV.cmake

Upvotes: 2

Related Questions