[Sanitizers Win] Move duplicate Windows-specific compiler flags to a common CMake variable
Reviewed at http://reviews.llvm.org/D3952
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209889 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index 78d2492..0f6260a 100644
--- a/cmake/Modules/AddCompilerRT.cmake
+++ b/cmake/Modules/AddCompilerRT.cmake
@@ -113,6 +113,8 @@
LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
endmacro()
+set(COMPILER_RT_TEST_CFLAGS)
+
# Unittests support.
set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)
set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc)
@@ -124,8 +126,18 @@
)
if(MSVC)
+ # clang doesn't support exceptions on Windows yet.
+ list(APPEND COMPILER_RT_TEST_CFLAGS
+ -D_HAS_EXCEPTIONS=0)
+
+ # We should teach clang to understand "#pragma intrinsic", see PR19898.
+ list(APPEND COMPILER_RT_TEST_CFLAGS -Wno-undefined-inline)
+
# Clang doesn't support SEH on Windows yet.
list(APPEND COMPILER_RT_GTEST_CFLAGS -DGTEST_HAS_SEH=0)
+
+ # gtest use a lot of stuff marked as deprecated on Windows.
+ list(APPEND COMPILER_RT_GTEST_CFLAGS -Wno-deprecated-declarations)
endif()
# Link objects into a single executable with COMPILER_RT_TEST_COMPILER,