Skip to content

Commit

Permalink
cmake: Disable C++ exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfonseca committed Mar 20, 2015
1 parent 5cebfd8 commit c354ea0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -190,6 +190,11 @@ if (MSVC)
string (REGEX REPLACE "/GR *" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")

# Disable C++ exceptions
add_definitions (-D_HAS_EXCEPTIONS=0)
string (REGEX REPLACE "/EHsc *" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c-")

# Enable math constants defines
add_definitions (-D_USE_MATH_DEFINES)

Expand Down Expand Up @@ -261,6 +266,9 @@ else ()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
endif ()

# Disable C++ exceptions
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")

# Enable stack protection
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fstack-protector-all")
Expand Down

0 comments on commit c354ea0

Please sign in to comment.