Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is my makelists file for CV bridge using openCV2. I struggled for a while on this install but don't remember where I found the solution...so just giving you the file that works for me.

In my case this is Jade on 14.04 but installed CVbridge using the current git within last month.

In the end I removed reference to 2 or 3. I left in the commented lines so you get a feeling of what I played with while finding answer.

Maybe this will help in your case as well. I would post this as a comment but too long for comment. Good luck!

cmake_minimum_required(VERSION 2.8)
project(cv_bridge)

find_package(catkin REQUIRED COMPONENTS rosconsole sensor_msgs)

if(NOT ANDROID)
  find_package(PythonLibs)
  if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
    find_package(Boost REQUIRED python)
  else()
    find_package(Boost REQUIRED python3)
  endif()
else()
find_package(Boost REQUIRED)
endif()

find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})
#target_link_libraries(${OpenCV_LIBRARIES})

#find_package(OpenCV 2 REQUIRED)
#find_package(OpenCV 3 REQUIRED
#  COMPONENTS
#    opencv_core
#    opencv_imgproc
#    opencv_imgcodecs
#  CONFIG
#)

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES ${PROJECT_NAME}
  CATKIN_DEPENDS rosconsole sensor_msgs
  DEPENDS OpenCV
  CFG_EXTRAS cv_bridge-extras.cmake
)

catkin_python_setup()

include_directories(include ${Boost_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})

if(NOT ANDROID)
add_subdirectory(python)
endif()
add_subdirectory(src)
if(CATKIN_ENABLE_TESTING)
  add_subdirectory(test)
endif()

# install the include folder
install(
  DIRECTORY include/${PROJECT_NAME}/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)