[libc++] Fix linker script generation

Handle the case when libc++abi and libunwind are being built together
with libc++ in the runtimes build. This logic was used in the previous
implementation but dropped in r374116.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374510 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Petr Hosek 2019-10-11 04:54:35 +00:00
parent dda1e448f9
commit 437d5a5dcf

View File

@ -31,7 +31,9 @@ function(define_linker_script target)
set(link_libraries)
if (interface_libs)
foreach(lib IN LISTS interface_libs)
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 link_libraries "${CMAKE_LINK_LIBRARY_FLAG}$<TARGET_PROPERTY:${lib},OUTPUT_NAME>")
else()
list(APPEND link_libraries "${CMAKE_LINK_LIBRARY_FLAG}${lib}")