diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3c9b063f77..01b6c0a3e6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -493,9 +493,7 @@ foreach(target ${test_targets}) endif() if("${target}" STREQUAL "exo_planet_c_api") - if(MSVC) - target_compile_options(${target} PRIVATE /EHs-c-) - elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Intel|Clang|NVHPC)") + if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Intel|Clang|NVHPC)") target_compile_options(${target} PRIVATE -fno-exceptions) endif() endif() diff --git a/tests/exo_planet_c_api.cpp b/tests/exo_planet_c_api.cpp index 9e85a32808..d37d6bb8fc 100644 --- a/tests/exo_planet_c_api.cpp +++ b/tests/exo_planet_c_api.cpp @@ -3,8 +3,8 @@ // In production situations it is totally fine to build with // C++ Exception Handling enabled. However, here we want to ensure that // C++ Exception Handling is not required. -#ifdef __EMSCRIPTEN__ -// Too much trouble making the required cmake changes. +#if defined(_MSC_VER) || defined(__EMSCRIPTEN__) +// Too much trouble making the required cmake changes (see PR #5375). #else # ifdef __cpp_exceptions // https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#__cpp_exceptions