From 853959a4ce26591b57c8ac43a6fa038f6ec24144 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Wed, 23 Sep 2009 10:45:00 -0400
Subject: [PATCH] Fix KWSys SystemTools build on cygwin with -mwin32

Commit "Optimize KWSys SystemTools::FileExists on Windows" accidentally
added "#undef _WIN32" when including <windows.h> on cygwin, which breaks
builds using the -mwin32 flag.  This commit removes that line and fixes
the real error it was intended to avoid.
---
 SystemTools.cxx      | 3 +--
 kwsysDateStamp.cmake | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/SystemTools.cxx b/SystemTools.cxx
index 16683a9..96cde13 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -70,7 +70,6 @@
 #endif
 
 #ifdef __CYGWIN__
-# undef _WIN32
 extern "C" void cygwin_conv_to_win32_path(const char *path, char *win32_path);
 #endif
 
@@ -2614,7 +2613,7 @@ bool SystemTools::FileIsDirectory(const char* name)
   struct stat fs;
   if(stat(name, &fs) == 0)
     {
-#if defined( _WIN32 )
+#if defined( _WIN32 ) && !defined(__CYGWIN__)
     return ((fs.st_mode & _S_IFDIR) != 0);
 #else
     return S_ISDIR(fs.st_mode);
diff --git a/kwsysDateStamp.cmake b/kwsysDateStamp.cmake
index b37b5d9..2c7f664 100644
--- a/kwsysDateStamp.cmake
+++ b/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@ SET(KWSYS_DATE_STAMP_YEAR  2009)
 SET(KWSYS_DATE_STAMP_MONTH 09)
 
 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   22)
+SET(KWSYS_DATE_STAMP_DAY   23)
-- 
GitLab