diff --git a/CMakeLists.txt b/CMakeLists.txt index 5453cd07..c00e7329 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,6 @@ else() set(PROTOBUF_PURPOSE) endif() ign_find_package(IgnProtobuf - VERSION ${REQ_PROTOBUF_VER} REQUIRED PRETTY Protobuf PURPOSE ${PROTOBUF_PURPOSE}) diff --git a/include/ignition/transport/RepHandler.hh b/include/ignition/transport/RepHandler.hh index 1163c3eb..e2cb5ca0 100644 --- a/include/ignition/transport/RepHandler.hh +++ b/include/ignition/transport/RepHandler.hh @@ -26,7 +26,7 @@ #pragma warning(pop) #endif -#if GOOGLE_PROTOBUF_VERSION > 2999999 +#if GOOGLE_PROTOBUF_VERSION > 2999999 && GOOGLE_PROTOBUF_VERSION < 4022000 #include #endif @@ -127,7 +127,11 @@ namespace ignition return false; } -#if GOOGLE_PROTOBUF_VERSION > 2999999 +#if GOOGLE_PROTOBUF_VERSION >= 4022000 + auto msgReq = + google::protobuf::internal::DownCast(&_msgReq); + auto msgRep = google::protobuf::internal::DownCast(&_msgRep); +#elif GOOGLE_PROTOBUF_VERSION > 2999999 auto msgReq = google::protobuf::down_cast(&_msgReq); auto msgRep = google::protobuf::down_cast(&_msgRep); #else diff --git a/include/ignition/transport/SubscriptionHandler.hh b/include/ignition/transport/SubscriptionHandler.hh index d9fbd224..22486730 100644 --- a/include/ignition/transport/SubscriptionHandler.hh +++ b/include/ignition/transport/SubscriptionHandler.hh @@ -28,7 +28,7 @@ #include -#if GOOGLE_PROTOBUF_VERSION >= 3000000 +#if GOOGLE_PROTOBUF_VERSION >= 3000000 && GOOGLE_PROTOBUF_VERSION < 4022000 #include #endif @@ -198,7 +198,9 @@ namespace ignition if (!this->UpdateThrottling()) return true; -#if GOOGLE_PROTOBUF_VERSION >= 3000000 +#if GOOGLE_PROTOBUF_VERSION >= 4022000 + auto msgPtr = google::protobuf::internal::DownCast(&_msg); +#elif GOOGLE_PROTOBUF_VERSION >= 3000000 auto msgPtr = google::protobuf::down_cast(&_msg); #else auto msgPtr = google::protobuf::internal::down_cast(&_msg);