[PATCH] D28391: [CMake][libcxx] Do not rely on the existence of c++abi or unwind targets

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 17:40:14 PST 2017


phosek created this revision.
phosek added a reviewer: beanz.
phosek added a subscriber: llvm-commits.
phosek set the repository for this revision to rL LLVM.
Herald added a subscriber: mgorny.
Herald added a reviewer: EricWF.

There is no guaranteed order in which CMake files for individual runtimes are invoked and therefore we cannot rely on existence of targets defined in other runtimes. Use the new HAVE_<name> options instead in those cases.


Repository:
  rL LLVM

https://reviews.llvm.org/D28391

Files:
  CMakeLists.txt
  lib/CMakeLists.txt


Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -229,7 +229,8 @@
     if (LIBCXX_CXX_ABI_LIBRARY_PATH)
       set(MERGE_ARCHIVES_SEARCH_PATHS "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}")
     endif()
-    if (TARGET ${LIBCXX_CXX_ABI_LIBRARY})
+    if ((TARGET ${LIBCXX_CXX_ABI_LIBRARY}) OR
+        (${LIBCXX_CXX_ABI_LIBRARY} STREQUAL "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI))
       set(MERGE_ARCHIVES_ABI_TARGET "$<TARGET_LINKER_FILE:${LIBCXX_CXX_ABI_LIBRARY}>")
     else()
       set(MERGE_ARCHIVES_ABI_TARGET
@@ -300,7 +301,9 @@
   set(LIBCXX_INTERFACE_LIBRARY_NAMES)
   foreach(lib ${LIBCXX_INTERFACE_LIBRARIES})
     # FIXME: Handle cxxabi_static and unwind_static.
-    if (TARGET ${lib})
+    if (TARGET ${lib} OR
+        (${lib} MATCHES "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI) OR
+        (${lib} MATCHES "unwind(_static|_shared)?" AND HAVE_LIBUNWIND))
       list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "$<TARGET_PROPERTY:${lib},OUTPUT_NAME>")
     else()
       list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "${lib}")
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -110,8 +110,7 @@
           ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
     NO_DEFAULT_PATH
   )
-  if (NOT DEFINED LIBCXX_STANDALONE_BUILD AND
-      IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
+  if (IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
     set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
     set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
     set(LIBCXX_CXX_ABI_INTREE 1)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28391.83331.patch
Type: text/x-patch
Size: 1686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170106/563b9118/attachment.bin>


More information about the llvm-commits mailing list