Skip to content

Commit

Permalink
Fix error on MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Feb 25, 2017
1 parent 703960a commit db0d54f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion support/cmake/cxx11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion test/gtest/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down

0 comments on commit db0d54f

Please sign in to comment.