Fix error on MinGW

This commit is contained in:
Victor Zverovich 2017-02-25 06:53:55 -08:00
parent 703960aa54
commit db0d54f855
2 changed files with 13 additions and 2 deletions

View File

@ -20,7 +20,14 @@ if (FMT_USE_CPP11)
check_cxx_source_compiles("
#include <unistd.h>
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 <stdio.h>
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)

View File

@ -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__