Fix linking with just-built libc++abi (added in r214037).
authorAlexey Samsonov <vonosmas@gmail.com>
Mon, 28 Jul 2014 19:25:44 +0000 (19:25 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Mon, 28 Jul 2014 19:25:44 +0000 (19:25 +0000)
Pass target name ("cxxabi") to target_link_libraries(cxx ...) to ensure
that linker is able to locate just-built libc++abi in the build tree,
instead of relying on "-lc++abi" linker flag.

llvm-svn: 214114

libcxx/CMakeLists.txt

index 1345eef..df8cc05 100644 (file)
@@ -152,13 +152,16 @@ if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++" OR
     "${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
     )
 elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
+  if (LIBCXX_CXX_ABI_INTREE)
+    # Link against just-built "cxxabi" target.
+    set(CXXABI_LIBNAME cxxabi)
+  else()
+    # Assume c++abi is installed in the system, rely on -lc++abi link flag.
+    set(CXXABI_LIBNAME "c++abi")
+  endif()
   setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
-    "c++abi" "cxxabi.h" ""
+    ${CXXABI_LIBNAME} "cxxabi.h" ""
     )
-
-  if (LIBCXX_CXX_ABI_INTREE)
-    add_dependencies(LIBCXX_CXX_ABI_DEPS cxxabi)
-  endif ()
 elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
   setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
     "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""