[llvm] ba68802 - [FindGRPC.cmake] Use `llvm_add_library()` for the custom proto target instead of `add_llvm_library()`

Argyrios Kyrtzidis via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 09:43:03 PDT 2022


Author: Argyrios Kyrtzidis
Date: 2022-08-17T09:42:50-07:00
New Revision: ba688024077c3e51c6a0949246b2a1b76284e681

URL: https://github.com/llvm/llvm-project/commit/ba688024077c3e51c6a0949246b2a1b76284e681
DIFF: https://github.com/llvm/llvm-project/commit/ba688024077c3e51c6a0949246b2a1b76284e681.diff

LOG: [FindGRPC.cmake] Use `llvm_add_library()` for the custom proto target instead of `add_llvm_library()`

`add_llvm_library()` would cause the proto target to be added in `LLVMExports.cmake` and could fail an external configuration
of compiler-rt with error "The following imported targets are referenced, but are missing: grpc++ protobuf::libprotobuf"

Differential Revision: https://reviews.llvm.org/D132033

Added: 
    

Modified: 
    llvm/cmake/modules/FindGRPC.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/FindGRPC.cmake b/llvm/cmake/modules/FindGRPC.cmake
index 1408442fcc22d..ee779d958c853 100644
--- a/llvm/cmake/modules/FindGRPC.cmake
+++ b/llvm/cmake/modules/FindGRPC.cmake
@@ -132,7 +132,12 @@ function(generate_protos LibraryName ProtoFile)
         ARGS ${Flags} "${ProtoSourceAbsolutePath}"
         DEPENDS "${ProtoSourceAbsolutePath}")
 
-  add_llvm_library(${LibraryName} ${GeneratedProtoSource}
+  set(LIBTYPE STATIC)
+  if(NOT XCODE)
+    # The Xcode generator doesn't handle object libraries correctly.
+    list(APPEND LIBTYPE OBJECT)
+  endif()
+  llvm_add_library(${LibraryName} ${LIBTYPE} ${GeneratedProtoSource}
     PARTIAL_SOURCES_INTENDED
     LINK_LIBS PUBLIC grpc++ protobuf)
 


        


More information about the llvm-commits mailing list