features.cmake: enable exceptions and RTTI on MSVC

On MSVC, this warning is emitted when including <vector>, 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.
This commit is contained in:
Johannes Kauffmann
2022-09-11 02:36:43 +02:00
committed by Kai Blaschke
parent f40fd3f467
commit 9e5f86b75f

View File

@ -25,6 +25,8 @@ if(NOT MSVC)
)
else()
enable_cflags_if_supported(
/EHsc # Exception handling support
/GR # RTTI, for dynamic_cast
/W4
)
endif()