[libcxx-commits] [PATCH] D125393: [runtimes] Introduce object libraries

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 12 01:29:01 PDT 2022


phosek added inline comments.


================
Comment at: libcxx/src/CMakeLists.txt:295
   if (LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY)
-    if (APPLE)
-      set(MERGE_ARCHIVES_LIBTOOL "--use-libtool" "--libtool" "${CMAKE_LIBTOOL}")
-    endif()
-    add_custom_command(TARGET cxx_static POST_BUILD
-    COMMAND
-      ${Python3_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/merge_archives.py
-    ARGS
-      -o $<TARGET_LINKER_FILE:cxx_static>
-      --ar "${CMAKE_AR}"
-      ${MERGE_ARCHIVES_LIBTOOL}
-      "$<TARGET_LINKER_FILE:cxx_static>"
-      "$<TARGET_LINKER_FILE:libcxx-abi-static>"
-      ""
-    WORKING_DIRECTORY ${LIBCXX_BUILD_DIR}
-    DEPENDS ${MERGE_ARCHIVES_ABI_TARGET}
-    )
+    target_link_libraries(cxx_static PRIVATE libcxx-abi-static-objects)
   endif()
----------------
Note that this is a potential regression. Specifically, today you can merge static ABI libraries other than libcxxabi, but after this change only libcxxabi will be supported. I don't know if there are any users and if anyone is going to notice, but we should probably give an error when someone tries to use `LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY` with ABI library other than libcxxabi (we might also consider renaming that option to `LIBCXX_STATICALLY_LINK_LIBCXXABI_IN_STATIC_LIBRARY`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125393/new/

https://reviews.llvm.org/D125393



More information about the libcxx-commits mailing list