ROS Fuerte installed on my machine uses opencv 2.2. I would like to use only version 2.4.9. Its location /home/polar/soft/lib/opencv/opencv-2.4.9/build/lib.
How to do this with CMake, please? From my search, it seems that it find_librarywill solve the problem, but cannot make it work.
===== I enable 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()
find_package( PkgConfig REQUIRED)
pkg_check_modules( gsl REQUIRED gsl )
SET(corners_opencv_flag ok)
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)
SET(FILES_TO_RUN
${execFiles_corner_opencv}
)
PROJECT(VOLCANO)
SET(SRC ${VOLCANO_SOURCE_DIR}/src)
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)
include_directories(${SRC}/calculus)
include_directories(${SRC}/calculus/matrix)
SET(MY_LIB
${MY_LIB}
Calculus
CholeskyDecompose
)
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)
ADD_SUBDIRECTORY(src)
source
share