]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: find Protobuf via cmake config before module mode 69449/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Fri, 12 Jun 2026 10:17:26 +0000 (18:17 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Sat, 13 Jun 2026 12:15:25 +0000 (20:15 +0800)
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>
src/CMakeLists.txt

index a93a38d7501f14e1a5ee3a0d85c97b53e94fe48c..552dd7d760d9e1ef4b607f8b80f2daa209228105 100644 (file)
@@ -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)