From abb3050e39b81777a43241670d1c883f44882671 Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Thu, 9 May 2019 02:06:05 +0700 Subject: [PATCH] Suppress warning _CRT_SECURE_NO_WARNINGS in MSVC and -Wdeprecated-declarations Suppress warning _CRT_SECURE_NO_WARNINGS in MSVC and -Wdeprecated-declarations of POSIX functions in Clang target MSVC. Those functions are used by gtest. --- test/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e3667d06..d45fe681 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,9 +21,16 @@ if (NOT SUPPORTS_VARIADIC_TEMPLATES) target_compile_definitions(gmock PUBLIC GTEST_LANG_CXX11=0) endif () -# Workaround a bug in implementation of variadic templates in MSVC11. if (MSVC) + # Workaround a bug in implementation of variadic templates in MSVC11. target_compile_definitions(gmock PUBLIC _VARIADIC_MAX=10) + # Automatic enable exception + target_compile_options(gmock PUBLIC /EHsc) + # Disable MSVC warning of _CRT_INSECURE_DEPRECATE functions and POSIX functions + target_compile_definitions(gmock PUBLIC _CRT_SECURE_NO_WARNINGS) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options(gmock PUBLIC -Wno-deprecated-declarations) + endif () endif () # GTest doesn't detect with clang.