mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 00:58:48 -05:00
CMake: use check_symbol_exists also for inet_pton
It doesn't make much sense to only check if the function can be linked when it's not declared in any header and that is treated as an error. With the correct target Windows version set, the function is declared in ws2tcpip.h and the comment above the modified block is invalid. Also, move the definition of `_WIN32_WINNT` up to before all symbol availability checks so that we don't have to care which ones must be done after it. Tested with Visual Studio 2019 and current MinGW-w64. Closes https://github.com/curl/curl/pull/4808
This commit is contained in:
parent
16da8bcd71
commit
be578eea7e
@ -858,6 +858,16 @@ elseif(HAVE_LIBSOCKET)
|
|||||||
set(CMAKE_REQUIRED_LIBRARIES socket)
|
set(CMAKE_REQUIRED_LIBRARIES socket)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(ENABLE_INET_PTON)
|
||||||
|
# _WIN32_WINNT_VISTA (0x0600)
|
||||||
|
add_definitions(-D_WIN32_WINNT=0x0600)
|
||||||
|
else()
|
||||||
|
# _WIN32_WINNT_WINXP (0x0501)
|
||||||
|
add_definitions(-D_WIN32_WINNT=0x0501)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
|
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
|
||||||
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
||||||
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
||||||
@ -929,20 +939,7 @@ check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL)
|
|||||||
check_symbol_exists(ioctl "${CURL_INCLUDES}" HAVE_IOCTL)
|
check_symbol_exists(ioctl "${CURL_INCLUDES}" HAVE_IOCTL)
|
||||||
check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT)
|
check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT)
|
||||||
check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
|
check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
|
||||||
|
check_symbol_exists(inet_pton "${CURL_INCLUDES}" HAVE_INET_PTON)
|
||||||
# symbol exists in win32, but function does not.
|
|
||||||
if(WIN32)
|
|
||||||
if(ENABLE_INET_PTON)
|
|
||||||
check_function_exists(inet_pton HAVE_INET_PTON)
|
|
||||||
# _WIN32_WINNT_VISTA (0x0600)
|
|
||||||
add_definitions(-D_WIN32_WINNT=0x0600)
|
|
||||||
else()
|
|
||||||
# _WIN32_WINNT_WINXP (0x0501)
|
|
||||||
add_definitions(-D_WIN32_WINNT=0x0501)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
check_function_exists(inet_pton HAVE_INET_PTON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_symbol_exists(fsetxattr "${CURL_INCLUDES}" HAVE_FSETXATTR)
|
check_symbol_exists(fsetxattr "${CURL_INCLUDES}" HAVE_FSETXATTR)
|
||||||
if(HAVE_FSETXATTR)
|
if(HAVE_FSETXATTR)
|
||||||
|
Loading…
Reference in New Issue
Block a user