[PATCH] D68430: Don't use object libraries with Xcode

Jordan Rose via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 15:15:17 PDT 2019


jordan_rose created this revision.
jordan_rose added a reviewer: beanz.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.

Undoes some of the effects of D61909 <https://reviews.llvm.org/D61909> when using the Xcode CMake generator—it doesn't handle object libraries correctly at all. Attempts to still honor `BUILD_SHARED_LIBS` for Xcode, but I didn't actually test it. Should have no effect on non-Xcode generators.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68430

Files:
  clang/cmake/modules/AddClang.cmake


Index: clang/cmake/modules/AddClang.cmake
===================================================================
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -86,11 +86,15 @@
     # llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
     # so we need to handle it here.
     if(BUILD_SHARED_LIBS)
-      set(LIBTYPE SHARED OBJECT)
+      set(LIBTYPE SHARED)
     else()
-      set(LIBTYPE STATIC OBJECT)
+      set(LIBTYPE STATIC)
+    endif()
+    if(NOT XCODE)
+      # The Xcode generator doesn't handle object libraries correctly.
+      list(APPEND LIBTYPE OBJECT)
+      set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
     endif()
-    set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
   endif()
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68430.223110.patch
Type: text/x-patch
Size: 862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191003/18659a31/attachment.bin>


More information about the cfe-commits mailing list