Disable C++ exception handling on MSVC.
authorFrancois Pichet <pichet2000@gmail.com>
Sat, 4 Dec 2010 14:30:22 +0000 (14:30 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Sat, 4 Dec 2010 14:30:22 +0000 (14:30 +0000)
Total size of bin\Release on disk goes from 82.9 MB to 74.2 MB. (~10% saving)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120908 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
cmake/modules/LLVMProcessSources.cmake

index 28e90475d48171501afda49ecfab18866c6eefc6..371d73bbd98eb53be3cf49a1aadf8de368ddd21c 100644 (file)
@@ -247,6 +247,7 @@ if( MSVC )
   add_llvm_definitions( -D_SCL_SECURE_NO_DEPRECATE )
   add_llvm_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 )
   add_llvm_definitions( -wd4355 -wd4715 -wd4180 -wd4345 -wd4224 -wd4267 -wd4291 )
+  add_llvm_definitions( -wd4275)
 
   # Suppress 'new behavior: elements of array 'array' will be default initialized'
   add_llvm_definitions( -wd4351 )
index e8a5a9431a26d3fbfe53bab1341da4a61b45effc..7bfca207f6890c448eecaebe6a00f71689904994 100644 (file)
@@ -41,6 +41,9 @@ function(llvm_process_sources OUT_VAR)
   if( NOT LLVM_REQUIRES_EH )
     if( CMAKE_COMPILER_IS_GNUCXX )
       add_definitions( -fno-exceptions )
+    elseif( MSVC )
+      add_definitions( /EHs-c- )
+      add_definitions( /D_HAS_EXCEPTIONS=0 )
     endif()
   endif()
   if( NOT LLVM_REQUIRES_RTTI )