[libc++] Add missing link-time dependencies to the benchmarks
Since the benchmarks build with -nostdlib, they need to manually link
against some system libraries that are used by the benchmarks and the
GoogleBenchmark library itself.
Previously, we'd rely on the fact that these libraries were linked
through the PUBLIC dependencies of cxx_shared/cxx_static. However,
if we were to make these dependencies PRIVATE (as they should be
because they are implementation details of libc++), the benchmarks
would fail to link. This commit remediates that.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374053 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt
index efe7914..a5b801c 100644
--- a/benchmarks/CMakeLists.txt
+++ b/benchmarks/CMakeLists.txt
@@ -146,6 +146,15 @@
if (LLVM_USE_SANITIZER)
target_link_libraries(${libcxx_target} PRIVATE -ldl)
endif()
+ if (LIBCXX_HAS_C_LIB)
+ target_link_libraries(${libcxx_target} PRIVATE -lc)
+ endif()
+ if (LIBCXX_HAS_M_LIB)
+ target_link_libraries(${libcxx_target} PRIVATE -lm)
+ endif()
+ if (LIBCXX_HAS_PTHREAD_LIB)
+ target_link_libraries(${libcxx_target} PRIVATE -lpthread)
+ endif()
set_target_properties(${libcxx_target}
PROPERTIES
OUTPUT_NAME "${name}.libcxx.out"