cmake: don't set LLVM_COMPILER_IS_GCC_COMPATIBLE when using clang-cl
[oota-llvm.git] / cmake / modules / HandleLLVMOptions.cmake
index 931fcdc1133b18d217fb385c4bace9a37be1e6fa..2cec270e96ddb63a2fdc3eb20aad463c74e5307c 100644 (file)
@@ -8,6 +8,8 @@ include(CheckCXXCompilerFlag)
 
 if( CMAKE_COMPILER_IS_GNUCXX )
   set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
+elseif( MSVC )
+  set(LLVM_COMPILER_IS_GCC_COMPATIBLE OFF)
 elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
   set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
 endif()
@@ -182,6 +184,7 @@ if( MSVC )
     -wd4503 # Suppress ''identifier' : decorated name length exceeded, name was truncated'
     -wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible'
     -wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)'
+    -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception'
     
     # Promoted warnings.
     -w14062 # Promote 'enumerator in switch of enum is not handled' to level 1 warning.
@@ -239,6 +242,10 @@ macro(append_common_sanitizer_flags)
       NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
     add_flag_if_supported("-gline-tables-only")
   endif()
+  # Use -O1 even in debug mode, otherwise sanitizers slowdown is too large.
+  if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
+    add_flag_if_supported("-O1")
+  endif()
 endmacro()
 
 # Turn on sanitizers if necessary.
@@ -261,6 +268,11 @@ if(LLVM_USE_SANITIZER)
   endif()
 endif()
 
+# Turn on -gsplit-dwarf if requested
+if(LLVM_USE_SPLIT_DWARF)
+  add_llvm_definitions("-gsplit-dwarf")
+endif()
+
 add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
 add_llvm_definitions( -D__STDC_FORMAT_MACROS )
 add_llvm_definitions( -D__STDC_LIMIT_MACROS )