Skip to content

Commit a2578d1

Browse files
Disable exceptions on ICPC (#3621)
1 parent d909f80 commit a2578d1

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

tests/CMakeLists.txt

+12-7
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,18 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
7878
endif()
7979

8080
# disable exceptions for test-disabled_exceptions
81-
json_test_set_test_options(test-disabled_exceptions COMPILE_DEFINITIONS JSON_NOEXCEPTION)
82-
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
83-
json_test_set_test_options(test-disabled_exceptions COMPILE_OPTIONS -fno-exceptions)
84-
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
85-
# disabled due to https://github.com/nlohmann/json/discussions/2824
86-
#json_test_set_test_options(test-disabled_exceptions COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0 COMPILE_OPTIONS /EH)
87-
endif()
81+
json_test_set_test_options(test-disabled_exceptions
82+
COMPILE_DEFINITIONS
83+
JSON_NOEXCEPTION
84+
# disabled due to https://github.com/nlohmann/json/discussions/2824
85+
#$<$<CXX_COMPILER_ID:MSVC>:_HAS_EXCEPTIONS=0>
86+
COMPILE_OPTIONS
87+
$<$<CXX_COMPILER_ID:AppleClang>:-fno-exceptions> $<$<CXX_COMPILER_ID:Clang>:-fno-exceptions>
88+
$<$<CXX_COMPILER_ID:GNU>:-fno-exceptions>
89+
$<$<CXX_COMPILER_ID:Intel>:-fno-exceptions> $<$<CXX_COMPILER_ID:IntelLLVM>:-fno-exceptions>
90+
# disabled due to https://github.com/nlohmann/json/discussions/2824
91+
#$<$<CXX_COMPILER_ID:MSVC>:/EH>
92+
)
8893

8994
# raise timeout of expensive Unicode test
9095
json_test_set_test_options(test-unicode4 TEST_PROPERTIES TIMEOUT 3000)

0 commit comments

Comments
 (0)