From db5dabc74a2903c8fa240049f1f365d4f80b1e38 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Fri, 3 Sep 2021 19:41:59 +0530 Subject: [PATCH] CMake: Fix build in cygwin (#422) As cygwin environment has both socket.h and winsock2.h headers check WIN32 not to include the later one here Fix By: Biswapriyo Nath (@Biswa96) --- 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")