From 54f3bf0cb86ec3e23b844f72943db26d69295a9f Mon Sep 17 00:00:00 2001 From: artpaul Date: Sat, 8 May 2021 21:35:15 +0500 Subject: [PATCH] disable exceptions if -fno-exceptions flag is set --- include/cxxopts.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 478ae84..8383d82 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -58,13 +58,22 @@ THE SOFTWARE. # define CXXOPTS_NODISCARD #endif +// Disable exceptions if the specific compiler flags are set. +#if !(defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) +# define CXXOPTS_NO_EXCEPTIONS +#endif + +#ifdef CXXOPTS_NO_EXCEPTIONS +# include +#endif + #ifndef CXXOPTS_VECTOR_DELIMITER # define CXXOPTS_VECTOR_DELIMITER ',' #endif #define CXXOPTS__VERSION_MAJOR 5 #define CXXOPTS__VERSION_MINOR 0 -#define CXXOPTS__VERSION_PATCH 1 +#define CXXOPTS__VERSION_PATCH 2 namespace cxxopts {