diff --git a/cv_bridge/CMakeLists.txt b/cv_bridge/CMakeLists.txt index 997bef3e1..c203aad1f 100644 --- a/cv_bridge/CMakeLists.txt +++ b/cv_bridge/CMakeLists.txt @@ -13,7 +13,7 @@ if(NOT ANDROID) else() find_package(Boost REQUIRED) endif() -find_package(OpenCV 3 REQUIRED +find_package(OpenCV REQUIRED COMPONENTS opencv_core opencv_imgproc diff --git a/cv_bridge/src/CMakeLists.txt b/cv_bridge/src/CMakeLists.txt index 37ba30eea..6d91003bf 100644 --- a/cv_bridge/src/CMakeLists.txt +++ b/cv_bridge/src/CMakeLists.txt @@ -32,10 +32,12 @@ if (PYTHON_VERSION_MAJOR VERSION_EQUAL 3) add_definitions(-DPYTHON3) endif() -if (OpenCV_VERSION_MAJOR VERSION_EQUAL 3) -add_library(${PROJECT_NAME}_boost module.cpp module_opencv3.cpp) +if (OpenCV_VERSION_MAJOR VERSION_EQUAL 4) + add_library(${PROJECT_NAME}_boost module.cpp module_opencv4.cpp) +elseif(OpenCV_VERSION_MAJOR VERSION_EQUAL 3) + add_library(${PROJECT_NAME}_boost module.cpp module_opencv3.cpp) else() -add_library(${PROJECT_NAME}_boost module.cpp module_opencv2.cpp) + add_library(${PROJECT_NAME}_boost module.cpp module_opencv2.cpp) endif() target_link_libraries(${PROJECT_NAME}_boost ${Boost_LIBRARIES} ${catkin_LIBRARIES}