Skip to content

Commit 75871ef

Browse files
committed
Add -fno-exceptions to compiler options for exo_planet_c_api
1 parent a0eb9f3 commit 75871ef

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tests/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,12 @@ foreach(target ${test_targets})
493493
endif()
494494
endforeach()
495495

496+
if(MSVC)
497+
target_compile_options("exo_planet_c_api" PRIVATE /EHs-c-)
498+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Intel|Clang)")
499+
target_compile_options("exo_planet_c_api" PRIVATE -fno-exceptions)
500+
endif()
501+
496502
# Provide nice organisation in IDEs
497503
source_group(
498504
TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include"

tests/exo_planet_c_api.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
// Copyright (c) 2024 The pybind Community.
22

3+
#ifdef __EXCEPTIONS
4+
# error This test is meant to be built with C++ Exception Handling disabled.
5+
// In production situations it is totally fine to build with
6+
// C++ Exception Handling enabled. Here we just want to ensure that
7+
// C++ Exception Handling is not required.
8+
#endif
9+
310
// THIS MUST STAY AT THE TOP!
411
#include <pybind11/compat/pybind11_conduit_v1.h> // VERY light-weight dependency.
512

0 commit comments

Comments
 (0)