diff options
author | Sumanth Gundapaneni <sgundapa@codeaurora.org> | 2016-01-13 22:09:47 +0000 |
---|---|---|
committer | Sumanth Gundapaneni <sgundapa@codeaurora.org> | 2016-01-13 22:09:47 +0000 |
commit | 81a23423380895b662874e6da8a85a781ba5d95a (patch) | |
tree | eeb4a1d6db75167b3b4c61c7ab74ed7edf2655a4 /cmake/Modules | |
parent | f882241f23fa83710e8bd4112a9975bc5cad2d31 (diff) |
With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling
environment, the unit tests fail to link. This patch does the following changes
>Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the
way it's used.
>Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that
cross-compiler would be able to build/compile the unit tests
>Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that
cross-compiler would be able to link the unit tests (if needed)
Differential Revision:http://reviews.llvm.org/D15082
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules')
-rw-r--r-- | cmake/Modules/AddCompilerRT.cmake | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake index 6f401b1fa..e458b0e82 100644 --- a/cmake/Modules/AddCompilerRT.cmake +++ b/cmake/Modules/AddCompilerRT.cmake @@ -165,7 +165,10 @@ function(add_compiler_rt_runtime name type) endif() endfunction() -set(COMPILER_RT_TEST_CFLAGS) +# when cross compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help +# in compilation and linking of unittests. +string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS}) +set(COMPILER_RT_UNITTEST_LINKFLAGS ${COMPILER_RT_UNITTEST_CFLAGS}) # Unittests support. set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest) @@ -177,14 +180,14 @@ set(COMPILER_RT_GTEST_CFLAGS -I${COMPILER_RT_GTEST_PATH} ) -append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_TEST_CFLAGS) +append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS) if(MSVC) # clang doesn't support exceptions on Windows yet. - list(APPEND COMPILER_RT_TEST_CFLAGS -D_HAS_EXCEPTIONS=0) + list(APPEND COMPILER_RT_UNITTEST_CFLAGS -D_HAS_EXCEPTIONS=0) # We should teach clang to understand "#pragma intrinsic", see PR19898. - list(APPEND COMPILER_RT_TEST_CFLAGS -Wno-undefined-inline) + list(APPEND COMPILER_RT_UNITTEST_CFLAGS -Wno-undefined-inline) # Clang doesn't support SEH on Windows yet. list(APPEND COMPILER_RT_GTEST_CFLAGS -DGTEST_HAS_SEH=0) |