summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXing Xue <xingxue@outlook.com>2019-05-06 17:45:21 +0000
committerXing Xue <xingxue@outlook.com>2019-05-06 17:45:21 +0000
commit92576a984eae8beab655e0cb121a8ae2c72b882d (patch)
treebd6b6d272c85e96c6d8d3855331b64aa30d00dc2
parentf8e9cda8fc73c0b7f0047e8922f6dd6e1d46ca2b (diff)
downloadllvm-92576a984eae8beab655e0cb121a8ae2c72b882d.tar.gz
Add libc++ to link XRay test cases if libc++ is used to build CLANG
Summary: When libc++ is used to build CLANG, its XRay libraries libclang_rt.xray-*.a have dependencies on libc++. Therefore, libc++ is needed to link and run XRay test cases. For Linux -rpath is also needed to specify where to load libc++. This change sets macro LLVM_LIBCXX_USED to 1 if libc++ is actually used in the build. XRay tests then check the flag and add -L<llvm_shlib_dir> -lc++ and -Wl,-rpath=<llvm_shlib_dir> if needed. Reviewers: hubert.reinterpretcast, amyk, dberris, jasonliu, sfertile, EricWF Subscribers: dberris, mgorny, jsji, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61016 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360060 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--cmake/modules/HandleLLVMStdlib.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmake/modules/HandleLLVMStdlib.cmake b/cmake/modules/HandleLLVMStdlib.cmake
index a0706d8e0846..f0e22d1a5b33 100644
--- a/cmake/modules/HandleLLVMStdlib.cmake
+++ b/cmake/modules/HandleLLVMStdlib.cmake
@@ -14,6 +14,7 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
+ set(LLVM_LIBCXX_USED 0)
if(LLVM_ENABLE_LIBCXX)
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
check_cxx_compiler_flag("-stdlib=libc++" CXX_COMPILER_SUPPORTS_STDLIB)
@@ -22,6 +23,7 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
append("-stdlib=libc++"
CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS)
+ set(LLVM_LIBCXX_USED 1)
else()
message(WARNING "Can't specify libc++ with '-stdlib='")
endif()