diff --git a/support/cmake/cxx11.cmake b/support/cmake/cxx11.cmake index 02795a93..21d12543 100644 --- a/support/cmake/cxx11.cmake +++ b/support/cmake/cxx11.cmake @@ -20,7 +20,14 @@ if (FMT_USE_CPP11) check_cxx_source_compiles(" #include int main() {}" FMT_CPP11_UNISTD_H) - if (FMT_CPP11_CMATH AND FMT_CPP11_UNISTD_H) + # Check if snprintf works with -std=c++11. It may not in MinGW. + check_cxx_source_compiles(" + #include + int main() { + char buffer[10]; + snprintf(buffer, 10, \"foo\"); + }" FMT_CPP11_SNPRINTF) + if (FMT_CPP11_CMATH AND FMT_CPP11_UNISTD_H AND FMT_CPP11_SNPRINTF) set(CPP11_FLAG -std=c++11) else () check_cxx_compiler_flag(-std=gnu++11 HAVE_STD_GNUPP11_FLAG) diff --git a/test/gtest/gtest.h b/test/gtest/gtest.h index 4f3804f7..52d2ed6d 100644 --- a/test/gtest/gtest.h +++ b/test/gtest/gtest.h @@ -2823,7 +2823,11 @@ inline int IsATTY(int /* fd */) { return 0; } inline int IsATTY(int fd) { return _isatty(fd); } # endif // GTEST_OS_WINDOWS_MOBILE inline int StrCaseCmp(const char* s1, const char* s2) { - return _stricmp(s1, s2); +# if _EMULATE_GLIBC + return strcasecmp(s1, s2); +# else + return _stricmp(s1, s2); +# endif } inline char* StrDup(const char* src) { return _strdup(src); } # endif // __BORLANDC__