mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
build: update to not need _CRT_NONSTDC_NO_DEPRECATE with MSVC
Use non-deprecated CRT function variants on Windows. - introduce `curlx_fdopen()`, `curlx_close()` and use them. Map them to non-deprecated, underscored, CRT functions on Windows. - replace `close()` uses with either `sclose()` (for sockets) or `curlx_close()` (for files). - map `fileno`, `unlink`, `isatty` to their non-deprecated, underscored, versions on Windows. - tool_dirhie: map `mkdir` to `_mkdir` on Windows. - easy: use `_strdup()` on Windows, regardless of how `HAVE_STRDUP` is set. - cmake: assume `HAVE_STRDUP` on Windows. To allow dropping a detection hack using `_CRT_NONSTDC_NO_DEPRECATE` with MSVC. Windows always has `_strdup()` which the code uses, but also needs `HAVE_STRDUP` defined to disable curl's own `strdup()` implementation. - curl_setup.h: drop `_CRT_NONSTDC_NO_DEPRECATE` as no longer necessary. Closes #20212
This commit is contained in:
parent
dbc4603b09
commit
e50aa46fb2
25 changed files with 54 additions and 49 deletions
|
|
@ -193,9 +193,6 @@ if(WIN32)
|
|||
|
||||
# Apply to all feature checks
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
|
||||
if(MSVC)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_CRT_NONSTDC_NO_DEPRECATE") # for strdup() detection
|
||||
endif()
|
||||
|
||||
set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
|
||||
if(CURL_TARGET_WINDOWS_VERSION)
|
||||
|
|
@ -1537,7 +1534,6 @@ check_symbol_exists("send" "${CURL_INCLUDES}" HAVE_SEND) # proto/bsd
|
|||
check_function_exists("sendmsg" HAVE_SENDMSG)
|
||||
check_function_exists("sendmmsg" HAVE_SENDMMSG)
|
||||
check_symbol_exists("select" "${CURL_INCLUDES}" HAVE_SELECT) # proto/bsdsocket.h sys/select.h sys/socket.h
|
||||
check_symbol_exists("strdup" "string.h" HAVE_STRDUP)
|
||||
check_symbol_exists("memrchr" "string.h" HAVE_MEMRCHR)
|
||||
check_symbol_exists("alarm" "unistd.h" HAVE_ALARM)
|
||||
check_symbol_exists("fcntl" "fcntl.h" HAVE_FCNTL)
|
||||
|
|
@ -1575,11 +1571,14 @@ check_function_exists("getrlimit" HAVE_GETRLIMIT)
|
|||
check_function_exists("setlocale" HAVE_SETLOCALE)
|
||||
check_function_exists("setrlimit" HAVE_SETRLIMIT)
|
||||
|
||||
if(NOT WIN32)
|
||||
if(WIN32)
|
||||
set(HAVE_STRDUP 1) # to not define local implementation. curl uses _strdup() on Windows.
|
||||
else()
|
||||
check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # net/if.h
|
||||
check_function_exists("realpath" HAVE_REALPATH)
|
||||
check_function_exists("sched_yield" HAVE_SCHED_YIELD)
|
||||
check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP)
|
||||
check_symbol_exists("strdup" "string.h" HAVE_STRDUP)
|
||||
check_symbol_exists("stricmp" "string.h" HAVE_STRICMP)
|
||||
check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue