From 1dda078c619fb5a6a49d8d6cf755b3c4c11402d8 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 25 Jan 2017 06:06:25 +0100 Subject: [PATCH] cmake: Compile on Windows with C++ Exceptions --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9eee79e814..4f9da6bb3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,7 +200,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_L message(FATAL_ERROR "Dolphin requires at least GCC 5.0 (found ${CMAKE_CXX_COMPILER_VERSION})") endif() -if(NOT MSVC) +if(CMAKE_C_COMPILER_ID MATCHES "MSVC") + check_and_add_flag(EXCEPTIONS /EHsc) +else() add_definitions(-D_DEFAULT_SOURCE) check_and_add_flag(HAVE_WALL -Wall) # TODO: would like these but they produce overwhelming amounts of warnings @@ -231,7 +233,7 @@ if(NOT MSVC) if(FLAG_C_FOMIT_FRAME_POINTER) add_compile_options($<$:-fomit-frame-pointer>) endif() -endif(NOT MSVC) +endif() if(CMAKE_SYSTEM_NAME MATCHES "Windows") # Only MSBuild needs this, other generators will compile one file at a time