From d1eb68154f2a60c7d59e99d1504e6c6ac03fedb4 Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 28 May 2023 12:52:56 +0300 Subject: [PATCH] If exceptions are disabled, disable them in the bundled fmt as well --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3830dfe2..7ae5a4e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,10 +255,19 @@ foreach( endif() endforeach() -if(SPDLOG_NO_EXCEPTIONS AND NOT MSVC) - target_compile_options(spdlog PRIVATE -fno-exceptions) +# --------------------------------------------------------------------------------------- +# If exceptions are disabled, disable them in the bundled fmt as well +# --------------------------------------------------------------------------------------- +if(SPDLOG_NO_EXCEPTIONS) + if(NOT SPDLOG_FMT_EXTERNAL AND NOT SPDLOG_FMT_EXTERNAL_HO) + target_compile_definitions(spdlog PUBLIC FMT_EXCEPTIONS=0) + endif() + if(NOT MSVC) + target_compile_options(spdlog PRIVATE -fno-exceptions) + else() + target_compile_options(spdlog PRIVATE /EHsc) + endif() endif() - # --------------------------------------------------------------------------------------- # Build binaries # ---------------------------------------------------------------------------------------