[libc++] Fix linking libc++abi in standalone builds
authorRaul Tambre <raul@tambre.ee>
Thu, 2 Apr 2020 13:34:02 +0000 (09:34 -0400)
committerLouis Dionne <ldionne@apple.com>
Thu, 2 Apr 2020 13:36:33 +0000 (09:36 -0400)
In standalone builds the cxxabi_shared and cxxabi_static targets don't exist.
We need to link against the library itself.

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

libcxx/cmake/Modules/HandleLibCXXABI.cmake

index 3cd9481..2cdf822 100644 (file)
@@ -103,9 +103,18 @@ if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
     )
 elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
   set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_SOURCE_DIR}/../libcxxabi/include")
+
+  if(LIBCXX_STANDALONE_BUILD)
+    set(shared c++abi)
+    set(static c++abi)
+  else()
+    set(shared cxxabi_shared)
+    set(static cxxabi_static)
+  endif()
+
   setup_abi_lib(
     "-DLIBCXX_BUILDING_LIBCXXABI"
-    "cxxabi_shared" "cxxabi_static" "cxxabi.h;__cxxabi_config.h" "")
+    "${shared}" "${static}" "cxxabi.h;__cxxabi_config.h" "")
 elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
   set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   setup_abi_lib(