diff --git a/cmake/ROS2.cmake b/cmake/ROS2.cmake index 8fa0837..fdec141 100644 --- a/cmake/ROS2.cmake +++ b/cmake/ROS2.cmake @@ -38,6 +38,10 @@ foreach(pkg ${ROS2_DEPENDENCIES}) find_package(${pkg} REQUIRED) endforeach() +if(${cv_bridge_VERSION} GREATER "3.3.0") + add_definitions(-DUSE_CV_BRIDGE_HPP) +endif() + ament_auto_find_build_dependencies(REQUIRED ${ROS2_DEPENDENCIES}) # diff --git a/src/frequency_cam_ros2.cpp b/src/frequency_cam_ros2.cpp index 63d9d6c..0c2a644 100644 --- a/src/frequency_cam_ros2.cpp +++ b/src/frequency_cam_ros2.cpp @@ -15,7 +15,11 @@ #include "frequency_cam/frequency_cam_ros2.h" +#ifdef USE_CV_BRIDGE_HPP +#include +#else #include +#endif #include #include