[libcxx-commits] [libcxxabi] r362311 - [libcxx] Use libtool when merging archives on Apple platforms

Petr Hosek via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 1 18:14:32 PDT 2019


Author: phosek
Date: Sat Jun  1 18:14:31 2019
New Revision: 362311

URL: http://llvm.org/viewvc/llvm-project?rev=362311&view=rev
Log:
[libcxx] Use libtool when merging archives on Apple platforms

ar doesn't produce the correct results when used for linking static
archives on Apple platforms, so instead use libtool -static which is
the official way to build static archives on those platforms.

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

Modified:
    libcxxabi/trunk/src/CMakeLists.txt

Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=362311&r1=362310&r2=362311&view=diff
==============================================================================
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Sat Jun  1 18:14:31 2019
@@ -226,6 +226,10 @@ if (LIBCXXABI_ENABLE_STATIC)
     list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_static")
   endif()
 
+  if (APPLE)
+    set(MERGE_ARCHIVES_LIBTOOL "--use-libtool" "--libtool" "${CMAKE_LIBTOOL}")
+  endif()
+
   # Merge the the libc++abi.a and libunwind.a into one.
   if(LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
     add_custom_command(TARGET cxxabi_static POST_BUILD
@@ -233,6 +237,7 @@ if (LIBCXXABI_ENABLE_STATIC)
       ARGS
         -o "$<TARGET_LINKER_FILE:cxxabi_static>"
         --ar "${CMAKE_AR}"
+        ${MERGE_ARCHIVES_LIBTOOL}
         "$<TARGET_LINKER_FILE:cxxabi_static>"
         "$<TARGET_LINKER_FILE:unwind_static>"
       WORKING_DIRECTORY ${LIBCXXABI_BUILD_DIR}




More information about the libcxx-commits mailing list