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

Argyrios Kyrtzidis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 08:21:16 PDT 2022


akyrtzi created this revision.
Herald added a subscriber: mgorny.
Herald added a project: All.
akyrtzi requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

`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"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132033

Files:
  llvm/cmake/modules/FindGRPC.cmake


Index: llvm/cmake/modules/FindGRPC.cmake
===================================================================
--- llvm/cmake/modules/FindGRPC.cmake
+++ llvm/cmake/modules/FindGRPC.cmake
@@ -132,7 +132,12 @@
         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)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132033.453291.patch
Type: text/x-patch
Size: 661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220817/66aeae0f/attachment.bin>


More information about the llvm-commits mailing list