From 793744af2670ee1349815684c083e9c5b7952084 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Fri, 3 Sep 2021 19:22:39 +0530
Subject: [PATCH] CMake: Fix build in cygwin

 As cygwin environment has both socket.h and winsock2.h
 headers check WIN32 not to include the later one here
---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 256ca4d5..23d1fc49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -195,11 +195,14 @@ ELSE ()
 ENDIF ()
 
 # Include order matters for these windows files.
+# As cygwin environment has both socket.h and winsock2.h
+# headers check WIN32 not to include the later one here
+IF (WIN32)
 CHECK_INCLUDE_FILES ("winsock2.h;windows.h"            HAVE_WINSOCK2_H)
 CHECK_INCLUDE_FILES ("winsock2.h;ws2tcpip.h;windows.h" HAVE_WS2TCPIP_H)
 CHECK_INCLUDE_FILES ("winsock.h;windows.h"             HAVE_WINSOCK_H)
 CHECK_INCLUDE_FILES (windows.h                         HAVE_WINDOWS_H)
-
+ENDIF ()
 
 # Set system-specific compiler flags
 IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
