From 0d6f0a42136e7f34f10c2cca22e0d6549b524cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Tue, 21 Sep 2021 10:02:41 +0100 Subject: [PATCH] MinGW-w64: Add guards for MSVC macro definitions Add a comment too. --- CMakeLists.txt | 1 + cmakeconfig.h.in | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa6998d8ee..692fb00e4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -476,6 +476,7 @@ if( CMAKE_C_COMPILER_ID MATCHES "MSVC") # in pcap-stdinc.h when compiling C++ files, e.g. the Qt UI /DPSAPI_VERSION=1 /D_ALLOW_KEYWORD_MACROS + # Disable deprecation of POSIX function names. # https://stackoverflow.com/questions/37845163/what-is-the-purpose-of-microsofts-underscore-c-functions /D_CRT_NONSTDC_NO_WARNINGS ) diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 2677e58673..7bc92686cb 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -292,6 +292,9 @@ # if !defined(QT_VERSION) || !defined(_SSIZE_T_DEFINED) typedef int ssize_t; # endif +# define strncasecmp strnicmp +# define popen _popen +# define pclose _pclose #endif #if defined(_WIN32) @@ -305,10 +308,6 @@ */ # define YY_NO_UNISTD_H -# define strncasecmp strnicmp -# define popen _popen -# define pclose _pclose - # ifndef __STDC__ # define __STDC__ 0 # endif