ROS Fuerte I installed on my machine uses opencv 2.2. I would like to use 2.4.9 version just installed. Its location is /home/polar/soft/lib/opencv/opencv-2.4.9/build/lib
.
How to do that with CMake, please?
From my search, it seems that find_library
would solve the issue, but was not able to make it work.
===== I include opencv in my cpp codes like this
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include "opencv2/imgproc/imgproc.hpp"
=========== HERE MY CMAKE
cmake_minimum_required(VERSION 2.8)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
rosbuild_genmsg()
rosbuild_gensrv()
# GSL
find_package( PkgConfig REQUIRED)
pkg_check_modules( gsl REQUIRED gsl )
SET(corners_opencv_flag ok)
#*******************************************************************
#*******************************************************************
#****** CORNERS OPENCV
#*******************************************************************
#*******************************************************************
if(corners_opencv_flag)
#---
SET(execFiles_corner_opencv
corner_v1
)
#---
foreach(file_ros ${execFiles_corner_opencv})
rosbuild_add_executable(${file_ros} computer-vision/corners/${file_ros}.cpp )
endforeach(file_ros)
#---
endif(corners_opencv_flag)
#-------------------
# STACK
#--------------------
SET(FILES_TO_RUN
${execFiles_corner_opencv}
)
#=======================================================
#
# CUSTOM LIBRARIES
#
#
#=======================================================
PROJECT(VOLCANO)
SET(SRC ${VOLCANO_SOURCE_DIR}/src)
#******* boost
find_package( Boost REQUIRED COMPONENTS program_options regex )
include_directories( ${Boost_INCLUDE_DIRS} )
if(Boost_FOUND)
message("\n\n Boost found \n\n")
endif()
find_package(OpenCV REQUIRED PATHS /home/polar/soft/lib/opencv/opencv-2.4.9/cmake)
#===== Calculus
include_directories(${SRC}/calculus)
include_directories(${SRC}/calculus/matrix)
SET(MY_LIB
${MY_LIB}
Calculus
CholeskyDecompose
)
#-------------------------------------------
# Linking the executables against the
#-------------------------------------------
foreach(file2link ${FILES_TO_RUN})
target_link_libraries(${file2link}
${MY_LIB}
${MY_LIB}
${gsl_LIBRARIES}
${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_REGEX_LIBRARY}
${OpenCV_LIB}
)
endforeach(file2link)
#--- sources folders
ADD_SUBDIRECTORY(src)