From 63d644559255ccc29305ba5d1f245318a8175d40 Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Thu, 9 May 2019 02:14:14 +0700 Subject: [PATCH] Turn on exceptions automatically in MSVC User must manually turn on exceptions otherwise error occurs when compiling `format.cc` as below fmt-master\include\fmt/format-inl.h(891,3): error: cannot use 'try' with exceptions disabled FMT_TRY { ^ --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee0142c5..46b43438 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,6 +161,9 @@ endif () if (FMT_PEDANTIC) target_compile_options(fmt PRIVATE ${PEDANTIC_COMPILE_FLAGS}) endif () +if (MSVC) + target_compile_options(fmt PRIVATE /EHsc) +endif () target_compile_features(fmt INTERFACE ${FMT_REQUIRED_FEATURES})