summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt58
1 files changed, 37 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21fdf2951..67cc51ed9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,8 +47,13 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND
NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.")
endif()
-set(TARGET_64_BIT_CFLAGS "-m64")
-set(TARGET_32_BIT_CFLAGS "-m32")
+if (NOT MSVC)
+ set(TARGET_64_BIT_CFLAGS "-m64")
+ set(TARGET_32_BIT_CFLAGS "-m32")
+else()
+ set(TARGET_64_BIT_CFLAGS "")
+ set(TARGET_32_BIT_CFLAGS "")
+endif()
# List of architectures we can target.
set(COMPILER_RT_SUPPORTED_ARCH)
@@ -83,7 +88,9 @@ macro(test_target_arch arch)
endmacro()
if("${LLVM_NATIVE_ARCH}" STREQUAL "X86")
- test_target_arch(x86_64 ${TARGET_64_BIT_CFLAGS})
+ if (NOT MSVC)
+ test_target_arch(x86_64 ${TARGET_64_BIT_CFLAGS})
+ endif()
test_target_arch(i386 ${TARGET_32_BIT_CFLAGS})
elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
test_target_arch(powerpc64 ${TARGET_64_BIT_CFLAGS})
@@ -114,25 +121,34 @@ function(filter_available_targets out_var)
endfunction()
# Provide some common commmandline flags for Sanitizer runtimes.
-set(SANITIZER_COMMON_CFLAGS
- -fPIC
- -fno-builtin
- -fno-exceptions
- -fomit-frame-pointer
- -funwind-tables
- -fno-stack-protector
- -Wno-gnu # Variadic macros with 0 arguments for ...
- -O3
- )
-if(NOT WIN32)
- list(APPEND SANITIZER_COMMON_CFLAGS -fvisibility=hidden)
-endif()
-# Build sanitizer runtimes with debug info.
-check_cxx_compiler_flag(-gline-tables-only SUPPORTS_GLINE_TABLES_ONLY_FLAG)
-if(SUPPORTS_GLINE_TABLES_ONLY_FLAG)
- list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only)
+if (NOT MSVC)
+ set(SANITIZER_COMMON_CFLAGS
+ -fPIC
+ -fno-builtin
+ -fno-exceptions
+ -fomit-frame-pointer
+ -funwind-tables
+ -fno-stack-protector
+ -Wno-gnu # Variadic macros with 0 arguments for ...
+ -O3
+ -fvisibility=hidden
+ )
else()
- list(APPEND SANITIZER_COMMON_CFLAGS -g)
+ set(SANITIZER_COMMON_CFLAGS
+ /MT
+ /Zi
+ /GS-
+ /wd4722
+ )
+endif()
+# Build sanitizer runtimes with debug info. (MSVC gets /Zi above)
+if (NOT MSVC)
+ check_cxx_compiler_flag(-gline-tables-only SUPPORTS_GLINE_TABLES_ONLY_FLAG)
+ if(SUPPORTS_GLINE_TABLES_ONLY_FLAG)
+ list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only)
+ else()
+ list(APPEND SANITIZER_COMMON_CFLAGS -g)
+ endif()
endif()
# Warnings suppressions.
check_cxx_compiler_flag(-Wno-variadic-macros SUPPORTS_NO_VARIADIC_MACROS_FLAG)