mirror of
https://github.com/lifegpc/c-utils.git
synced 2026-06-06 05:08:45 +08:00
Add cookies support
This commit is contained in:
@@ -48,9 +48,12 @@ if (WIN32)
|
||||
check_symbol_exists(strerror_s "string.h" HAVE_STRERROR_S)
|
||||
check_symbol_exists(_wcserror_s "string.h" HAVE__WCSERROR_S)
|
||||
check_symbol_exists(printf_s "stdio.h" HAVE_PRINTF_S)
|
||||
check_symbol_exists(fprintf_s "stdio.h" HAVE_FPRINTF_S)
|
||||
check_symbol_exists(sscanf_s "stdio.h" HAVE_SSCANF_S)
|
||||
check_symbol_exists(_stricmp "string.h" HAVE__STRICMP)
|
||||
check_symbol_exists(_strnicmp "string.h" HAVE__STRNICMP)
|
||||
check_symbol_exists(_mkgmtime "time.h" HAVE__MKGMTIME)
|
||||
check_symbol_exists(_get_timezone "time.h" HAVE__GET_TIMEZONE)
|
||||
else()
|
||||
check_symbol_exists(fseeko "stdio.h" HAVE_FSEEKO)
|
||||
check_symbol_exists(fseeko64 "stdio.h" HAVE_FSEEKO64)
|
||||
@@ -60,12 +63,24 @@ endif()
|
||||
check_symbol_exists(strcasecmp "string.h" HAVE_STRCASECMP)
|
||||
check_symbol_exists(strncasecmp "string.h" HAVE_STRNCASECMP)
|
||||
check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
|
||||
check_symbol_exists(strptime "time.h" HAVE_STRPTIME)
|
||||
if (NOT HAVE_STRPTIME)
|
||||
set(TMP "${CMAKE_REQUIRED_DEFINITIONS}")
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE)
|
||||
check_symbol_exists(strptime "time.h" HAVE_STRPTIME1)
|
||||
if (HAVE_STRPTIME1)
|
||||
add_compile_definitions(_XOPEN_SOURCE)
|
||||
set(HAVE_STRPTIME 1)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "${TMP}")
|
||||
endif()
|
||||
set(HAVE_GNU_SOURCE OFF)
|
||||
if (NOT WIN32)
|
||||
set(TMP "${CMAKE_REQUIRED_DEFINITIONS}")
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
||||
check_symbol_exists(fcloseall "stdio.h" HAVE_FCLOSEALL)
|
||||
if (HAVE_FCLOSEALL)
|
||||
check_symbol_exists(timegm "time.h" HAVE_TIMEGM)
|
||||
if (HAVE_FCLOSEALL OR HAVE_TIMEGM)
|
||||
add_compile_definitions(_GNU_SOURCE)
|
||||
set(HAVE_GNU_SOURCE ON)
|
||||
endif()
|
||||
@@ -74,6 +89,10 @@ endif()
|
||||
if (HAVE_STRERROR_R)
|
||||
test_strerror_r(HAVE_GNU_STRERROR_R ${HAVE_GNU_SOURCE})
|
||||
endif()
|
||||
if (NOT MSVC)
|
||||
check_symbol_exists(timezone "time.h" HAVE_TIMEZONE)
|
||||
check_symbol_exists(tzset "time.h" HAVE_TZSET)
|
||||
endif()
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/utils_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/utils_config.h")
|
||||
|
||||
if ("${CMAKE_C_COMPILER_ID}" STREQUAL GNU)
|
||||
@@ -118,6 +137,10 @@ set(SOURCE_FILE_HEADERS
|
||||
http_client.h
|
||||
)
|
||||
|
||||
if (NOT HAVE_STRPTIME)
|
||||
list(APPEND SOURCE_FILE strptime/strptime.c strptime/strptime.h)
|
||||
endif()
|
||||
|
||||
add_library(utils STATIC ${SOURCE_FILE} ${SOURCE_FILE_HEADERS})
|
||||
target_compile_definitions(utils PRIVATE HAVE_UTILS_CONFIG_H)
|
||||
if (Iconv_FOUND)
|
||||
|
||||
Reference in New Issue
Block a user