From 7a8ea3eee1dcff4eaa5398d1cf5739fa32eccd9e Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Tue, 10 Apr 2018 22:18:33 +0200 Subject: [PATCH] cmake: Add exception handling support to MSVC compile flags Since STL types may throw, MSVC needs to get told to support exceptions by specifying the /EHsc flag. Otherwise, it warns about the lack thereof, even though Quassel itself does not use nor handle exceptions. Closes GH-350. --- cmake/QuasselCompileSettings.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/QuasselCompileSettings.cmake b/cmake/QuasselCompileSettings.cmake index 68fccdc0..b499a18f 100644 --- a/cmake/QuasselCompileSettings.cmake +++ b/cmake/QuasselCompileSettings.cmake @@ -66,12 +66,15 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-function -Wno-undef -fno-strict-aliasing") -# For MSVC, at least do a version sanity check +# For MSVC, at least do a version sanity check... elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0") message(FATAL_ERROR "Your compiler is too old; you need at least Visual Studio 2015 (MSVC 19.0+), GCC 4.8+, Clang 3.3+, or any other compiler with full C++11 support.") endif() + # ... and enable exception handling (required for STL types) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") + # Unknown/unsupported compiler else() message(WARNING "Unknown or unsupported compiler. Make sure to enable C++11 support. Good luck.") -- 2.20.1