[PATCH] D68430: Don't use object libraries with Xcode
Jordan Rose via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 4 11:04:02 PDT 2019
jordan_rose updated this revision to Diff 223250.
jordan_rose added a comment.
Okay, having Xcode force-load the static libraries doesn't seem bad at all.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68430/new/
https://reviews.llvm.org/D68430
Files:
clang/cmake/modules/AddClang.cmake
clang/tools/clang-shlib/CMakeLists.txt
Index: clang/tools/clang-shlib/CMakeLists.txt
===================================================================
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -6,7 +6,13 @@
get_property(clang_libs GLOBAL PROPERTY CLANG_STATIC_LIBS)
foreach (lib ${clang_libs})
- list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
+ if(XCODE)
+ # Xcode doesn't support object libraries, so we have to trick it into
+ # linking the static libraries instead.
+ list(APPEND _DEPS "-force_load" ${lib})
+ else()
+ list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
+ endif()
list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>)
list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
endforeach ()
Index: clang/cmake/modules/AddClang.cmake
===================================================================
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -86,9 +86,13 @@
# 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)
endif()
set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68430.223250.patch
Type: text/x-patch
Size: 1483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191004/13f81724/attachment.bin>
More information about the cfe-commits
mailing list