diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2015-04-02 09:11:21 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-04-10 14:32:53 +0200 |
commit | 584ab49b7b639a55aa2b2c0a6a9d62116e2229c1 (patch) | |
tree | fbe04d677a52aef36099d964ee03033351aa920b | |
parent | dc30183d8aa9f06c2dc9375a882d16e87dbd4272 (diff) | |
download | libssh-584ab49b7b639a55aa2b2c0a6a9d62116e2229c1.tar.gz libssh-584ab49b7b639a55aa2b2c0a6a9d62116e2229c1.tar.xz libssh-584ab49b7b639a55aa2b2c0a6a9d62116e2229c1.zip |
cmake: Detect network function correctly on Windows
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 195f25cfbd4a13d16bd14c657c993a979215402a)
-rw-r--r-- | ConfigureChecks.cmake | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 652a6515..a2ae35a9 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -99,11 +99,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) @@ -114,17 +109,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) |