[libcxx-commits] [PATCH] D97314: [libc++abi] Link against cxx-headers when available

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 23 11:38:14 PST 2021


ldionne created this revision.
Herald added subscribers: jkorous, mgorny.
ldionne requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.

Using the cxx-headers target created by libc++ is better than using
LIBCXXABI_LIBCXX_INCLUDES since it propagates other things like the
include of the __config_site header, which is necessary to build
successfully in certain configurations.

We should in fact get rid of LIBCXXABI_LIBCXX_INCLUDES, however some
clients using the old standalone build still need it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97314

Files:
  libcxxabi/src/CMakeLists.txt


Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -55,8 +55,6 @@
   endif()
 endif()
 
-include_directories("${LIBCXXABI_LIBCXX_INCLUDES}")
-
 if (LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
   add_definitions(-DHAVE___CXA_THREAD_ATEXIT_IMPL)
 endif()
@@ -175,6 +173,11 @@
 if (LIBCXXABI_ENABLE_SHARED)
   add_library(cxxabi_shared SHARED ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
   target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
+  if (TARGET cxx-headers)
+    target_link_libraries(cxxabi_shared PRIVATE cxx-headers)
+  else()
+    target_include_directories(cxxabi_shared PRIVATE "${LIBCXXABI_LIBCXX_INCLUDES}")
+  endif()
   if (TARGET pstl::ParallelSTL)
     target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL)
   endif()
@@ -242,6 +245,11 @@
 if (LIBCXXABI_ENABLE_STATIC)
   add_library(cxxabi_static STATIC ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
   target_link_libraries(cxxabi_static PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES})
+  if (TARGET cxx-headers)
+    target_link_libraries(cxxabi_static PRIVATE cxx-headers)
+  else()
+    target_include_directories(cxxabi_static PRIVATE "${LIBCXXABI_LIBCXX_INCLUDES}")
+  endif()
   if (TARGET pstl::ParallelSTL)
     target_link_libraries(cxxabi_static PUBLIC pstl::ParallelSTL)
   endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97314.325856.patch
Type: text/x-patch
Size: 1445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210223/701e59a7/attachment.bin>


More information about the libcxx-commits mailing list