aboutsummaryrefslogtreecommitdiff
path: root/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-04-02 09:11:21 +0200
committerAndreas Schneider <asn@cryptomilk.org>2015-04-10 13:32:09 +0200
commit195f25cfbd4a13d16bd14c657c993a979215402a (patch)
tree66a55ace018d38e468d4b8edc4b1555162b31a0f /ConfigureChecks.cmake
parent1cb940c44a10a3c2a4feaa9d71691a962619ca94 (diff)
downloadlibssh-195f25cfbd4a13d16bd14c657c993a979215402a.tar.gz
libssh-195f25cfbd4a13d16bd14c657c993a979215402a.tar.xz
libssh-195f25cfbd4a13d16bd14c657c993a979215402a.zip
cmake: Detect network function correctly on Windows
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r--ConfigureChecks.cmake28
1 files changed, 17 insertions, 11 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index c4bf6c28..e3a39dd9 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -103,11 +103,6 @@ check_function_exists(isblank HAVE_ISBLANK)
check_function_exists(strncpy HAVE_STRNCPY)
check_function_exists(vsnprintf HAVE_VSNPRINTF)
check_function_exists(snprintf HAVE_SNPRINTF)
-check_function_exists(poll HAVE_POLL)
-check_function_exists(select HAVE_SELECT)
-check_function_exists(getaddrinfo HAVE_GETADDRINFO)
-check_symbol_exists(ntohll arpa/inet.h HAVE_NTOHLL)
-check_symbol_exists(htonll arpa/inet.h HAVE_HTONLL)
if (WIN32)
check_function_exists(_strtoui64 HAVE__STRTOUI64)
@@ -118,17 +113,28 @@ if (WIN32)
check_function_exists(_snprintf_s HAVE__SNPRINTF_S)
if (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H)
- set(HAVE_GETADDRINFO TRUE)
- set(HAVE_GETHOSTBYNAME TRUE)
- if (MSVC)
- set(HAVE_NTOHLL TRUE)
- set(HAVE_HTONLL TRUE)
- endif (MSVC)
+ check_symbol_exists(ntohll winsock2.h HAVE_NTOHLL)
+ check_symbol_exists(htonll winsock2.h HAVE_HTONLL)
+
+ set(CMAKE_REQUIRED_LIBRARIES ws2_32)
+ check_symbol_exists(select "winsock2.h;ws2tcpip.h" HAVE_SELECT)
+ check_symbol_exists(poll "winsock2.h;ws2tcpip.h" HAVE_SELECT)
+ # The getaddrinfo function is defined to the WspiapiGetAddrInfo inline function
+ check_symbol_exists(getaddrinfo "winsock2.h;ws2tcpip.h" HAVE_GETADDRINFO)
+ set(CMAKE_REQUIRED_LIBRARIES)
endif (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H)
set(HAVE_SELECT TRUE)
+else (WIN32)
+ check_function_exists(poll HAVE_POLL)
+ check_function_exists(select HAVE_SELECT)
+ check_function_exists(getaddrinfo HAVE_GETADDRINFO)
+
+ check_symbol_exists(ntohll arpa/inet.h HAVE_NTOHLL)
+ check_symbol_exists(htonll arpa/inet.h HAVE_HTONLL)
endif (WIN32)
+
if (UNIX)
if (NOT LINUX)
# libsocket (Solaris)