From 1bf6c965e491e1851c8102dafa4a87c4deb085d9 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 10 Dec 2015 20:21:40 +0100 Subject: cmake: Correctly check for *snprintf functions on Windows BUG: https://red.libssh.org/issues/205 Signed-off-by: Andreas Schneider --- ConfigureChecks.cmake | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 1917ce21..22d98e25 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -125,16 +125,19 @@ endif (NOT WITH_GCRYPT) check_function_exists(isblank HAVE_ISBLANK) check_function_exists(strncpy HAVE_STRNCPY) -check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF) -check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF) +if (NOT WIN32) + check_function_exists(vsnprintf HAVE_VSNPRINTF) + check_function_exists(snprintf HAVE_SNPRINTF) +endif (NOT WIN32) if (WIN32) - check_function_exists(_strtoui64 HAVE__STRTOUI64) + check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF) + check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF) - check_function_exists(_vsnprintf_s HAVE__VSNPRINTF_S) - check_function_exists(_vsnprintf HAVE__VSNPRINTF) - check_function_exists(_snprintf HAVE__SNPRINTF) - check_function_exists(_snprintf_s HAVE__SNPRINTF_S) + check_symbol_exists(_vsnprintf_s "stdio.h" HAVE__VSNPRINTF_S) + check_symbol_exists(_vsnprintf "stdio.h" HAVE__VSNPRINTF) + check_symbol_exists(_snprintf "stdio.h" HAVE__SNPRINTF) + check_symbol_exists(_snprintf_s "stdio.h" HAVE__SNPRINTF_S) if (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H) check_symbol_exists(ntohll winsock2.h HAVE_NTOHLL) @@ -148,6 +151,8 @@ if (WIN32) set(CMAKE_REQUIRED_LIBRARIES) endif (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H) + check_function_exists(_strtoui64 HAVE__STRTOUI64) + set(HAVE_SELECT TRUE) else (WIN32) check_function_exists(poll HAVE_POLL) -- cgit v1.2.3