[PATCH] D90030: [CMake] Fix hardcoding of protobuf output basename. NFC

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 23 05:30:36 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2d25004a1372: [CMake] Fix hardcoding of protobuf output basename. NFC (authored by sammccall).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90030/new/

https://reviews.llvm.org/D90030

Files:
  llvm/cmake/modules/FindGRPC.cmake


Index: llvm/cmake/modules/FindGRPC.cmake
===================================================================
--- llvm/cmake/modules/FindGRPC.cmake
+++ llvm/cmake/modules/FindGRPC.cmake
@@ -88,9 +88,10 @@
   cmake_parse_arguments(PARSE_ARGV 2 PROTO "GRPC" "" "")
   get_filename_component(ProtoSourceAbsolutePath "${CMAKE_CURRENT_SOURCE_DIR}/${ProtoFile}" ABSOLUTE)
   get_filename_component(ProtoSourcePath ${ProtoSourceAbsolutePath} PATH)
+  get_filename_component(Basename ${ProtoSourceAbsolutePath} NAME_WLE)
 
-  set(GeneratedProtoSource "${CMAKE_CURRENT_BINARY_DIR}/Index.pb.cc")
-  set(GeneratedProtoHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.pb.h")
+  set(GeneratedProtoSource "${CMAKE_CURRENT_BINARY_DIR}/${Basename}.pb.cc")
+  set(GeneratedProtoHeader "${CMAKE_CURRENT_BINARY_DIR}/${Basename}.pb.h")
   set(Flags
     --cpp_out="${CMAKE_CURRENT_BINARY_DIR}"
     --proto_path="${ProtoSourcePath}")
@@ -98,8 +99,8 @@
     list(APPEND Flags
       --grpc_out="${CMAKE_CURRENT_BINARY_DIR}"
       --plugin=protoc-gen-grpc="${GRPC_CPP_PLUGIN}")
-    list(APPEND GeneratedProtoSource "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.cc")
-    list(APPEND GeneratedProtoHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.h")
+    list(APPEND GeneratedProtoSource "${CMAKE_CURRENT_BINARY_DIR}/${Basename}.grpc.pb.cc")
+    list(APPEND GeneratedProtoHeader "${CMAKE_CURRENT_BINARY_DIR}/${Basename}.grpc.pb.h")
   endif()
   add_custom_command(
         OUTPUT ${GeneratedProtoSource} ${GeneratedProtoHeader}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90030.300250.patch
Type: text/x-patch
Size: 1501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201023/13fdb5fb/attachment.bin>


More information about the llvm-commits mailing list