From: Sun Yuechi Date: Fri, 12 Jun 2026 10:17:26 +0000 (+0800) Subject: cmake: find Protobuf via cmake config before module mode X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ede8e34f61baf53d3bd516c4492c09c433cefbc0;p=ceph.git cmake: find Protobuf via cmake config before module mode 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 --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a93a38d7501..552dd7d760d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1023,10 +1023,12 @@ option(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT "build nvmeof gateway monitor client" 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)