Skip to content

Commit

Permalink
use EHsc flag for MSVC and -fexceptions flag for GNU
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintWish committed Sep 24, 2024
1 parent 78a9681 commit cd5e23c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,18 @@ function(set_common_properties TARGET_NAME)

if (UNIX)
target_compile_definitions(${TARGET_NAME} PRIVATE
_snprintf=snprintf
_stricmp=strcasecmp
_strnicmp=strncasecmp
_strdup=strdup
_vsnprintf=vsnprintf)
endif(UNIX)

# Disable C++ exceptions, which is enabled by default with CMake?
# Make sure C++ exceptions are enabled.
if (MSVC)
target_compile_options(${TARGET_NAME} PUBLIC /EHa)
target_compile_options(${TARGET_NAME} PUBLIC /EHsc)
else()
target_compile_options(${TARGET_NAME} PUBLIC -fno-exceptions)
target_compile_options(${TARGET_NAME} PUBLIC -fexceptions)
endif()

target_compile_definitions(${TARGET_NAME} PRIVATE
Expand Down

0 comments on commit cd5e23c

Please sign in to comment.