mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
cmake: tidy-ups and rebase fixups
- limit `SIZEOF_SA_FAMILY_T` detection to non-Windows. - make sure `sys/socket.h` exists before detecting `SIZEOF_SA_FAMILY_T`. - limit `mach_absolute_time()` detection to `APPLE`. Drop from Windows pre-cache. - skip `HAVE_LIBSOCKET` detection for Windows, drop pre-cached value. - drop redundant pre-cached `HAVE_LIBZ` for Windows. - `curl_required_libpaths()`: stop accepting multiple arguments. To prepare for `CMAKE_REQUIRED_LINK_DIRECTORIES` support. Follow-up to7bab201abe
#15193 - GSS: fix recent rebase mistakes: - fix variable name. - do not add a header twice. Follow-up to91d451b488
#15157 - GSS: quote a variable. Closes #15271
This commit is contained in:
parent
a3601cf571
commit
01a8157997
@ -73,10 +73,9 @@ macro(curl_dependency_option _dependency)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Convert the passed paths (or list of paths) to libpath linker options
|
||||
# and add them to CMAKE_REQUIRED_LINK_OPTIONS.
|
||||
macro(curl_required_libpaths)
|
||||
set(_libpaths "${ARGN}")
|
||||
# Convert the passed paths to libpath linker options and add them to CMAKE_REQUIRED_LINK_OPTIONS.
|
||||
macro(curl_required_libpaths _libpaths_arg)
|
||||
set(_libpaths "${_libpaths_arg}")
|
||||
foreach(_libpath IN LISTS _libpaths)
|
||||
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "${CMAKE_LIBRARY_PATH_FLAG}${_libpath}")
|
||||
endforeach()
|
||||
|
@ -102,14 +102,12 @@ set(HAVE_IF_NAMETOINDEX 0)
|
||||
set(HAVE_GETRLIMIT 0)
|
||||
set(HAVE_SETRLIMIT 0)
|
||||
set(HAVE_FSETXATTR 0)
|
||||
set(HAVE_LIBSOCKET 0)
|
||||
set(HAVE_SETLOCALE 1)
|
||||
set(HAVE_SETMODE 1)
|
||||
set(HAVE__SETMODE 1)
|
||||
set(HAVE_GETPEERNAME 1)
|
||||
set(HAVE_GETSOCKNAME 1)
|
||||
set(HAVE_GETHOSTNAME 1)
|
||||
set(HAVE_LIBZ 0)
|
||||
|
||||
set(HAVE_RECV 1)
|
||||
set(HAVE_SEND 1)
|
||||
@ -169,7 +167,6 @@ set(HAVE_GETHOSTBYNAME_R 0)
|
||||
set(HAVE_SIGNAL 1)
|
||||
set(HAVE_SIGACTION 0)
|
||||
set(HAVE_GLIBC_STRERROR_R 0)
|
||||
set(HAVE_MACH_ABSOLUTE_TIME 0)
|
||||
set(HAVE_GETIFADDRS 0)
|
||||
set(HAVE_FCNTL_O_NONBLOCK 0)
|
||||
set(HAVE_IOCTLSOCKET 1)
|
||||
|
@ -478,9 +478,11 @@ if(ENABLE_THREADED_RESOLVER)
|
||||
endif()
|
||||
|
||||
# Check for all needed libraries
|
||||
check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
|
||||
if(HAVE_LIBSOCKET)
|
||||
set(CURL_LIBS "socket;${CURL_LIBS}")
|
||||
if(NOT WIN32)
|
||||
check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
|
||||
if(HAVE_LIBSOCKET)
|
||||
set(CURL_LIBS "socket;${CURL_LIBS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_function_exists("gethostname" HAVE_GETHOSTNAME)
|
||||
@ -1218,10 +1220,7 @@ if(CURL_USE_GSSAPI)
|
||||
check_include_files("${_include_list};gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H)
|
||||
|
||||
if(GSS_FLAVOUR STREQUAL "MIT")
|
||||
check_include_files("${_include_list};gssapi/gssapi_krb5.h" HAVE_GSSAPI_GSSAPI_KRB5_H)
|
||||
if(HAVE_GSSAPI_GSSAPI_H)
|
||||
list(APPEND _include_list "gssapi/gssapi.h")
|
||||
endif()
|
||||
check_include_files("${_include_list};gssapi/gssapi_krb5.h" _have_gssapi_gssapi_krb5_h)
|
||||
if(HAVE_GSSAPI_GSSAPI_GENERIC_H)
|
||||
list(APPEND _include_list "gssapi/gssapi_generic.h")
|
||||
endif()
|
||||
@ -1232,7 +1231,7 @@ if(CURL_USE_GSSAPI)
|
||||
if(NOT DEFINED HAVE_GSS_C_NT_HOSTBASED_SERVICE)
|
||||
set(CMAKE_REQUIRED_FLAGS "${GSS_CFLAGS} ${GSS_LDFLAGS}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${GSS_LIBRARIES})
|
||||
check_symbol_exists("GSS_C_NT_HOSTBASED_SERVICE" ${_include_list} HAVE_GSS_C_NT_HOSTBASED_SERVICE)
|
||||
check_symbol_exists("GSS_C_NT_HOSTBASED_SERVICE" "${_include_list}" HAVE_GSS_C_NT_HOSTBASED_SERVICE)
|
||||
endif()
|
||||
if(NOT HAVE_GSS_C_NT_HOSTBASED_SERVICE)
|
||||
set(HAVE_OLD_GSSMIT ON)
|
||||
@ -1603,7 +1602,9 @@ if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1900))
|
||||
# Earlier MSVC compilers had faulty snprintf implementations
|
||||
check_function_exists("snprintf" HAVE_SNPRINTF)
|
||||
endif()
|
||||
check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME)
|
||||
if(APPLE)
|
||||
check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME)
|
||||
endif()
|
||||
check_symbol_exists("inet_ntop" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP) # arpa/inet.h
|
||||
if(MSVC AND (MSVC_VERSION LESS_EQUAL 1600))
|
||||
set(HAVE_INET_NTOP OFF)
|
||||
@ -1617,18 +1618,16 @@ if(HAVE_FSETXATTR)
|
||||
endif()
|
||||
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
|
||||
check_type_size("sa_family_t" SIZEOF_SA_FAMILY_T)
|
||||
set(HAVE_SA_FAMILY_T ${HAVE_SIZEOF_SA_FAMILY_T})
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(WIN32)
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
|
||||
check_type_size("ADDRESS_FAMILY" SIZEOF_ADDRESS_FAMILY)
|
||||
set(HAVE_ADDRESS_FAMILY ${HAVE_SIZEOF_ADDRESS_FAMILY})
|
||||
cmake_pop_check_state()
|
||||
elseif(HAVE_SYS_SOCKET_H)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
|
||||
check_type_size("sa_family_t" SIZEOF_SA_FAMILY_T)
|
||||
set(HAVE_SA_FAMILY_T ${HAVE_SIZEOF_SA_FAMILY_T})
|
||||
endif()
|
||||
cmake_pop_check_state()
|
||||
|
||||
# Do curl specific tests
|
||||
foreach(_curl_test IN ITEMS
|
||||
|
Loading…
Reference in New Issue
Block a user