Skip to content

Commit 3b7bf9d

Browse files
committed
osi: Fix compatiblity with protobuf > v25
1 parent 55dc93e commit 3b7bf9d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

osi/src/cloe/utility/osi_utils.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <Eigen/Geometry> // for Isometry3d, Vector3d
2828

29+
#include <google/protobuf/stubs/common.h> // for GOOGLE_PROTOBUF_VERSION
2930
#include <google/protobuf/util/json_util.h> // for JsonPrint
3031

3132
#include <cloe/utility/geometry.hpp> // for quaternion_from_rpy
@@ -41,8 +42,10 @@ template <typename OSI_T>
4142
void osi_to_json(const OSI_T& msg, std::string* json_string) {
4243
google::protobuf::util::JsonPrintOptions options;
4344
options.add_whitespace = true;
45+
#if GOOGLE_PROTOBUF_VERSION < 5026000
4446
options.always_print_primitive_fields = true;
45-
google::protobuf::util::MessageToJsonString(msg, json_string, options);
47+
#endif
48+
std::ignore = google::protobuf::util::MessageToJsonString(msg, json_string, options);
4649
}
4750

4851
template void osi_to_json(const osi3::SensorData& msg, std::string* json_string);

0 commit comments

Comments
 (0)