Receive FMT_MSVC_EH from user

This commit is contained in:
denchat 2019-05-09 15:56:10 +07:00 committed by GitHub
parent eb420be65d
commit b17216a452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,9 +29,19 @@ if (MSVC)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Disable MSVC warnings of POSIX functions.
target_compile_options(gmock PUBLIC -Wno-deprecated-declarations)
# Mirroring MSVC cl default
target_compile_options(gmock PUBLIC /EHsc)
endif ()
# Insert FMT_MSVC_EH if user provides.
# if not, default to /EHsc in clang target msvc.
if (FMT_MSVC_EH)
set(FMT_CUSTOM_MSVC_EH ${FMT_MSVC_EH})
endif ()
else ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") )
set(FMT_CUSTOM_MSVC_EH /EHsc)
else ()
set(FMT_CUSTOM_MSVC_EH)
endif ()
target_compile_options(fmt PRIVATE ${FMT_CUSTOM_MSVC_EH})
endif ()
# GTest doesn't detect <tuple> with clang.