File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ option(immer_BUILD_EXAMPLES "Build examples" ON)
4242option (immer_BUILD_DOCS "Build docs" ON )
4343option (immer_BUILD_EXTRAS "Build extras" ON )
4444option (immer_INSTALL_FUZZERS "Install fuzzers" off )
45+ option (immer_ENABLE_EXCEPTIONS "Always enable exceptions regardless of detected compiler support" OFF )
46+ option (immer_DISABLE_EXCEPTIONS "Always disable exceptions regardless of detected compiler support" OFF )
47+
48+ if (immer_ENABLE_EXCEPTIONS AND immer_DISABLE_EXCEPTIONS)
49+ message (FATAL_ERROR "Cannot both enable and disable exceptions" )
50+ endif ()
4551
4652set (CXX_STANDARD
4753 14
@@ -101,6 +107,17 @@ target_include_directories(
101107 INTERFACE $<BUILD_INTERFACE :${immer_BINARY_DIR} />
102108 $<BUILD_INTERFACE :${immer_SOURCE_DIR} />
103109 $<INSTALL_INTERFACE :${CMAKE_INSTALL_INCLUDEDIR} >)
110+
111+ if (immer_ENABLE_EXCEPTIONS)
112+ message (STATUS "Explicitly enabling exceptions" )
113+ target_compile_definitions (immer INTERFACE IMMER_USE_EXCEPTIONS )
114+ endif ()
115+
116+ if (immer_DISABLE_EXCEPTIONS)
117+ message (STATUS "Explicitly disabling exceptions" )
118+ target_compile_definitions (immer INTERFACE IMMER_NO_EXCEPTIONS )
119+ endif ()
120+
104121install (TARGETS immer EXPORT ImmerConfig)
105122install (EXPORT ImmerConfig DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/Immer" )
106123install (DIRECTORY immer DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} " )
Original file line number Diff line number Diff line change 2222#endif
2323#endif
2424
25+ #if !defined(IMMER_USE_EXCEPTIONS) && !defined(IMMER_NO_EXCEPTIONS)
2526#if defined(_MSC_VER)
2627#if !_HAS_EXCEPTIONS
2728#define IMMER_NO_EXCEPTIONS
3132#define IMMER_NO_EXCEPTIONS
3233#endif
3334#endif
35+ #endif
3436
3537#ifdef IMMER_NO_EXCEPTIONS
3638#define IMMER_TRY if (true )
You can’t perform that action at this time.
0 commit comments