Skip to content

Commit

Permalink
[cmake] Enable explicitly exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvassilev committed Jul 21, 2023
1 parent 22af8f3 commit a12fe36
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,22 @@ endif ()
include(CheckCXXCompilerFlag)

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4141")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4018 /wd4267 /wd4715 /wd4146 /wd4129")
add_compile_options(/wd4251 /wd4141)
add_compile_options(/wd4018 /wd4267 /wd4715 /wd4146 /wd4129)
add_compile_options(/EHsc)
else()
add_compile_options(-fexceptions)
endif ()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
if(NOT XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-parameter -Wextra -Wreorder")
add_compile_options(-Wunused-parameter -Wextra -Wreorder)
endif()


CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP_17_FLAG)
if (HAS_CPP_17_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
add_compile_options(-std=c++17)
else ()
message(FATAL_ERROR "Unsupported compiler -- xeus requires C++17 support!")
endif ()
Expand Down

0 comments on commit a12fe36

Please sign in to comment.