How to link own build OpenCV instead of ros-hydro-opencv
Hi All
I've build OpenCV 2.4.9 from source and installed in "/opt/opencv". Meanwhile I have installed ROS Hydro which has ros-hydro-opencv2. Now I'm developing a catkin package that depends on OpenCV. My Cmake settings is as follows:
cmake_minimum_required(VERSION 2.8)
project(marker_finder)
set(CMAKE_PREFIX_PATH "/opt/opencv" ${CMAKE_PREFIX_PATH})
####################################################
# Dependencies:
find_package(catkin REQUIRED COMPONENTS roscpp roslib)
find_package( OpenCV REQUIRED )
####################################################
# Build library.
catkin_package(
INCLUDE_DIRS include
LIBRARIES marker_finder
CATKIN_DEPENDS roscpp roslib
DEPENDS opencv
)
include_directories(
include
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
message(STATUS ${OpenCV_INCLUDE_DIRS})
SET(MF_LIB_SRCS
src/...
)
SET(MF_LIB_HDRS
include/...
)
add_library (marker_finder ${MF_LIB_SRCS} ${MF_LIB_HDRS})
target_link_libraries (marker_finder
GL
GLU
${catkin_LIBRARIES}
${OpenCV_LIBRARIES})
install(TARGETS marker_finder LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(DIRECTORY include/marker_finder/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
The output of
message(STATUS ${OpenCV_INCLUDE_DIRS})
is
/opt/ros/hydro/include/opencv/opt/ros/hydro/include
Which is not what I expected.
/opt/opencv/include
So how can I make CMake find the correct OpenCV package I want ?