llvm.org GIT mirror llvm / 92576a9
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 Xing Xue 5 months ago
1 changed file(s) with 2 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1313
1414 include(CheckCXXCompilerFlag)
1515 include(CheckLinkerFlag)
16 set(LLVM_LIBCXX_USED 0)
1617 if(LLVM_ENABLE_LIBCXX)
1718 if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
1819 check_cxx_compiler_flag("-stdlib=libc++" CXX_COMPILER_SUPPORTS_STDLIB)
2122 append("-stdlib=libc++"
2223 CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
2324 CMAKE_MODULE_LINKER_FLAGS)
25 set(LLVM_LIBCXX_USED 1)
2426 else()
2527 message(WARNING "Can't specify libc++ with '-stdlib='")
2628 endif()