[libcxx-commits] [PATCH] D60114: [CMake] Differentiate between static and shared libc++abi

Shoaib Meenai via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 2 11:39:54 PDT 2019


smeenai added a comment.

LGTM, though I agree with @ldionne, and I'll wait for him (or another libc++ maintainer) to accept.



================
Comment at: libcxx/lib/CMakeLists.txt:64
   else()
     add_library_flags("-Wl,--whole-archive" "-Wl,-Bstatic")
+    add_library_flags("${LIBCXX_CXX_STATIC_ABI_LIBRARY}")
----------------
Not your diff, but CMake reorders static libraries on the link line in dependency order, so I've seen libraries get reordered out of the whole-archive sandwich. I don't know of a good way to handle that generically though ... making the entire sandwich be one giant argument (e.g. `"-Wl,--whole-archive,libfoo,--no-whole-archive"`) breaks when libfoo is a target, since CMake doesn't replace it with the path to the actual library, and using a generator expression breaks when libfoo isn't a target.

(On the same note, if you ever need to debug CMake's library reordering, `CMAKE_LINK_DEPENDS_DEBUG_MODE` is super useful.)


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D60114





More information about the libcxx-commits mailing list