Skip to content

Commit 4128c32

Browse files
committed
[cmake] Enable explicitly exceptions
1 parent 76f8e43 commit 4128c32

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,22 @@ endif ()
8282
include(CheckCXXCompilerFlag)
8383

8484
if (MSVC)
85-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4141")
86-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4018 /wd4267 /wd4715 /wd4146 /wd4129")
85+
add_compile_options(/wd4251 /wd4141)
86+
add_compile_options(/wd4018 /wd4267 /wd4715 /wd4146 /wd4129)
87+
add_compile_options(/EHsc)
88+
else()
89+
add_compile_options(-fexceptions)
8790
endif ()
8891

8992
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
9093
if(NOT XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
91-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-parameter -Wextra -Wreorder")
94+
add_compile_options(-Wunused-parameter -Wextra -Wreorder)
9295
endif()
9396

9497

9598
CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP_17_FLAG)
9699
if (HAS_CPP_17_FLAG)
97-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
100+
add_compile_options(-std=c++17)
98101
else ()
99102
message(FATAL_ERROR "Unsupported compiler -- xeus requires C++17 support!")
100103
endif ()

0 commit comments

Comments
 (0)