[llvm] 2d25004 - [CMake] Fix hardcoding of protobuf output basename. NFC
Sam McCall via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 05:30:26 PDT 2020
Author: Sam McCall
Date: 2020-10-23T14:29:57+02:00
New Revision: 2d25004a137223a02aa06e8bfd512a648f3b3f94
URL: https://github.com/llvm/llvm-project/commit/2d25004a137223a02aa06e8bfd512a648f3b3f94
DIFF: https://github.com/llvm/llvm-project/commit/2d25004a137223a02aa06e8bfd512a648f3b3f94.diff
LOG: [CMake] Fix hardcoding of protobuf output basename. NFC
Differential Revision: https://reviews.llvm.org/D90030
Added:
Modified:
llvm/cmake/modules/FindGRPC.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/FindGRPC.cmake b/llvm/cmake/modules/FindGRPC.cmake
index 757b16adefac..9e837a80661c 100644
--- a/llvm/cmake/modules/FindGRPC.cmake
+++ b/llvm/cmake/modules/FindGRPC.cmake
@@ -88,9 +88,10 @@ function(generate_protos LibraryName ProtoFile)
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 @@ function(generate_protos LibraryName ProtoFile)
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}
More information about the llvm-commits
mailing list