I'm doing this for the first time but couldn't get going with CMake find_package(OpenCV)
OpenCVModules.cmake is in the same folder as OpenCVConfig.cmake but for some reasons CMake configure fails with this error.
I'm on Windows using Visual Studio Express 2010, CMake v2.8.0 and OpenCV v2.4.9
CMake Error at D:/opencv/mybuild/install/x86/vc10/lib/OpenCVConfig.cmake:49 (include):
include could not find load file:
/OpenCVModules.cmake
Call Stack (most recent call first):
CMakeLists.txt:19 (FIND_PACKAGE)
I've to get this going with VS 2010 Express but I'm allowed to pick any compatible version of CMake and OpenCV for this project.
I'm doing this in CMakeLists.txt and the "OpenCVConfig.cmake" is the default one which gets shipped with OpenCV. I didn't modify it.
SET(OpenCV_DIR "D:/opencv/mybuild")
# this project requires OpenCV, so find it
FIND_PACKAGE( OpenCV )
INCLUDE_DIRECTORIES( ${OpenCV_INCLUDE_DIRS} )
Line#49 from OpenCVConfig.cmake looks like this
include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${OpenCV_MODULES_SUFFIX}.cmake)
Any help in the right direction is greatly appreciated. Thanks.
UPDATE1: if I modify line#49 by hard-coding the path, it works!
include(D:/opencv/mybuild/OpenCVModules${OpenCV_MODULES_SUFFIX}.cmake)
For some reasons ${CMAKE_CURRENT_LIST_DIR} is not getting set appropriately. This looks like dynamically changed variable. Why is this not set as expected?