summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2014-05-13 13:29:11 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2014-05-13 13:29:11 +0000
commitde8fc56e076226ac26a8d80b582fd1567eb670cf (patch)
treeae06db236a6f185efe24a6ae9701802b3e1c7ff1 /lib/sanitizer_common/tests/CMakeLists.txt
parent1b482591523290b26927e428af5a38643d71c1a7 (diff)
[Sanitizer tests] Land the sanitizer twin of the asan-only change r208682
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/tests/CMakeLists.txt')
-rw-r--r--lib/sanitizer_common/tests/CMakeLists.txt30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/sanitizer_common/tests/CMakeLists.txt b/lib/sanitizer_common/tests/CMakeLists.txt
index c7a7ee4a0..029319789 100644
--- a/lib/sanitizer_common/tests/CMakeLists.txt
+++ b/lib/sanitizer_common/tests/CMakeLists.txt
@@ -39,10 +39,32 @@ set(SANITIZER_TEST_CFLAGS_COMMON
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common
-DGTEST_HAS_RTTI=0
- -O2 -g -fno-rtti
+ -O2
-Werror=sign-compare
-Wno-non-virtual-dtor)
+append_if(COMPILER_RT_HAS_G_FLAG -g SANITIZER_TEST_CFLAGS_COMMON)
+append_if(COMPILER_RT_HAS_Zi_FLAG -Zi SANITIZER_TEST_CFLAGS_COMMON)
+
+append_if(COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti SANITIZER_TEST_CFLAGS_COMMON)
+append_if(COMPILER_RT_HAS_GR_FLAG -GR- SANITIZER_TEST_CFLAGS_COMMON)
+
+if(MSVC)
+ # System headers and gtest use a lot of deprecated stuff.
+ list(APPEND SANITIZER_TEST_CFLAGS_COMMON
+ -Wno-deprecated-declarations)
+
+ # clang-cl doesn't support exceptions yet.
+ list(APPEND SANITIZER_TEST_CFLAGS_COMMON
+ /fallback
+ -D_HAS_EXCEPTIONS=0)
+
+ # We should teach clang-cl to understand more pragmas.
+ list(APPEND SANITIZER_TEST_CFLAGS_COMMON
+ -Wno-unknown-pragmas
+ -Wno-undefined-inline)
+endif()
+
append_if(COMPILER_RT_HAS_LIBSTDCXX -lstdc++ SANITIZER_TEST_LINK_FLAGS_COMMON)
append_if(COMPILER_RT_HAS_LIBDL -ldl SANITIZER_TEST_LINK_FLAGS_COMMON)
append_if(COMPILER_RT_HAS_LIBPTHREAD -lpthread SANITIZER_TEST_LINK_FLAGS_COMMON)
@@ -69,7 +91,11 @@ function(get_sanitizer_common_lib_for_arch arch lib lib_name)
set(tgt_name "RTSanitizerCommon.test.${arch}")
endif()
set(${lib} "${tgt_name}" PARENT_SCOPE)
- set(${lib_name} "lib${tgt_name}.a" PARENT_SCOPE)
+ if(NOT MSVC)
+ set(${lib_name} "lib${tgt_name}.a" PARENT_SCOPE)
+ else()
+ set(${lib_name} "${tgt_name}.lib" PARENT_SCOPE)
+ endif()
endfunction()
# Sanitizer_common unit tests testsuite.