Module-mode FindProtobuf defines only the classic targets, so
gRPCConfig.cmake's find_dependency(Protobuf) fails on the partial
export set. Prefer config mode; fall back to module mode.
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
if(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT)
- # Find Protobuf installation
- # Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
- option(protobuf_MODULE_COMPATIBLE TRUE)
- find_package(Protobuf REQUIRED)
+ # Prefer config mode so gRPC sees protobuf's full target set
+ # (incl. upb); fall back to module mode.
+ find_package(Protobuf CONFIG)
+ if(NOT Protobuf_FOUND)
+ find_package(Protobuf REQUIRED)
+ endif()
set(_REFLECTION grpc++_reflection)
if(CMAKE_CROSSCOMPILING)