Add /EHs for targets for MSVC
authorLei Zhang <antiagainst@google.com>
Mon, 3 Apr 2017 17:41:20 +0000 (13:41 -0400)
committerDavid Neto <dneto@google.com>
Mon, 3 Apr 2017 19:41:01 +0000 (15:41 -0400)
CMakeLists.txt

index 214ff91..0cb338a 100644 (file)
@@ -114,6 +114,12 @@ function(spvtools_default_compile_options TARGET)
     endif()
   endif()
 
+  if (MSVC)
+    # Specify /EHs for exception handling. This makes using SPIRV-Tools as
+    # dependencies in other projects easier.
+    target_compile_options(${TARGET} PRIVATE /EHs)
+  endif()
+
   # For MinGW cross compile, statically link to the C++ runtime.
   # But it still depends on MSVCRT.dll.
   if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")