From b0281a5c844ea0b0d9e0104674474adf50810f49 Mon Sep 17 00:00:00 2001 From: BrutusTT Date: Wed, 4 Sep 2019 11:39:30 +0100 Subject: [PATCH] add OpenCV4 support addresses ros-perception/vision_opencv#272 --- cv_bridge/CMakeLists.txt | 2 +- cv_bridge/src/CMakeLists.txt | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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}