From 9e5f86b75f330037b33f009d6e2055c19bb3145a Mon Sep 17 00:00:00 2001 From: Johannes Kauffmann <19662702+JohannesKauffmann@users.noreply.github.com> Date: Sun, 11 Sep 2022 02:36:43 +0200 Subject: [PATCH] features.cmake: enable exceptions and RTTI on MSVC On MSVC, this warning is emitted when including , among others: warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc clang-cl won't even build without /EHsc and fails on the first try-statement. Since projectM uses the C++ standard library and because it uses exceptions itself, enable the flag. Also, since projectM uses dynamic_cast, enable RTTI. While both /EHsc and /GR are added by CMake by default, user-provided CMAKE_CXX_FLAGS will override the CMake default. So instead of relying on the CMake default, enable them explicitly. --- features.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features.cmake b/features.cmake index b4e76bc43..630e2326e 100644 --- a/features.cmake +++ b/features.cmake @@ -25,6 +25,8 @@ if(NOT MSVC) ) else() enable_cflags_if_supported( + /EHsc # Exception handling support + /GR # RTTI, for dynamic_cast /W4 ) endif()