|
|
|
@ -37,13 +37,13 @@ SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Install path helpers |
|
|
|
|
IF ("${CARES_INSTALL_LOCATION_LIBS}" STREQUAL "") |
|
|
|
|
IF (NOT DEFINED CARES_INSTALL_LOCATION_LIBS) |
|
|
|
|
SET (CARES_INSTALL_LOCATION_LIBS ${CMAKE_INSTALL_PREFIX}/lib CACHE INTERNAL "") |
|
|
|
|
ENDIF () |
|
|
|
|
IF ("${CARES_INSTALL_LOCATION_HEADERS}" STREQUAL "") |
|
|
|
|
IF (NOT DEFINED CARES_INSTALL_LOCATION_HEADERS) |
|
|
|
|
SET (CARES_INSTALL_LOCATION_HEADERS ${CMAKE_INSTALL_PREFIX}/include CACHE INTERNAL "") |
|
|
|
|
ENDIF () |
|
|
|
|
IF ("${CARES_INSTALL_LOCATION_BIN}" STREQUAL "") |
|
|
|
|
IF (NOT DEFINED CARES_INSTALL_LOCATION_BIN) |
|
|
|
|
SET (CARES_INSTALL_LOCATION_BIN ${CMAKE_INSTALL_PREFIX}/bin CACHE INTERNAL "") |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
@ -54,7 +54,7 @@ ENDIF () |
|
|
|
|
SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND") |
|
|
|
|
SET (CARES_INCLUDE_DIRS "${PROJECT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "CARES INCLUDE DIRECTORIES") |
|
|
|
|
SET (CARES_LIBRARIES ${PROJECT_NAME} CACHE INTERNAL "CARES LIBRARIES") |
|
|
|
|
IF (${CARES_STATIC} AND NOT ${CARES_SHARED}) |
|
|
|
|
IF (CARES_STATIC AND NOT CARES_SHARED) |
|
|
|
|
SET (CARES_DEFINITIONS "-DCARES_STATICLIB" CACHE INTERNAL "CARES DEFINITIONS") |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
@ -97,7 +97,7 @@ ENDIF() |
|
|
|
|
|
|
|
|
|
CHECK_LIBRARY_EXISTS (nsl gethostbyname "" HAVE_LIBNSL) |
|
|
|
|
CHECK_LIBRARY_EXISTS (socket gethostbyname "" HAVE_LIBSOCKET) |
|
|
|
|
IF (NOT ${HAVE_LIBSOCKET}) |
|
|
|
|
IF (NOT HAVE_LIBSOCKET) |
|
|
|
|
CHECK_LIBRARY_EXISTS (socket socket "" HAVE_LIBSOCKET) |
|
|
|
|
ENDIF () |
|
|
|
|
CHECK_LIBRARY_EXISTS (rt clock_gettime "" HAVE_LIBRT) |
|
|
|
@ -166,16 +166,16 @@ ADD_DEFINITIONS(${SYSFLAGS}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Tell C-Ares about libraries to depend on |
|
|
|
|
IF (${HAVE_LIBRESOLV}) |
|
|
|
|
IF (HAVE_LIBRESOLV) |
|
|
|
|
LIST (APPEND CARES_DEPENDENT_LIBS resolv) |
|
|
|
|
ENDIF () |
|
|
|
|
IF (${HAVE_LIBNSL}) |
|
|
|
|
IF (HAVE_LIBNSL) |
|
|
|
|
LIST (APPEND CARES_DEPENDENT_LIBS nsl) |
|
|
|
|
ENDIF () |
|
|
|
|
IF (${HAVE_LIBSOCKET}) |
|
|
|
|
IF (HAVE_LIBSOCKET) |
|
|
|
|
LIST (APPEND CARES_DEPENDENT_LIBS socket) |
|
|
|
|
ENDIF () |
|
|
|
|
IF (${HAVE_LIBRT}) |
|
|
|
|
IF (HAVE_LIBRT) |
|
|
|
|
LIST (APPEND CARES_DEPENDENT_LIBS rt) |
|
|
|
|
ENDIF () |
|
|
|
|
IF (WIN32) |
|
|
|
@ -345,7 +345,7 @@ SET (CMAKE_REQUIRED_LIBRARIES) |
|
|
|
|
# defaults. This should be much quicker and nearly as accurate ... and even |
|
|
|
|
# if not, it probably won't matter in the least. |
|
|
|
|
|
|
|
|
|
IF ("${HAVE_SSIZE_T}" AND "${HAVE_SOCKLEN_T}") |
|
|
|
|
IF (HAVE_SSIZE_T AND HAVE_SOCKLEN_T) |
|
|
|
|
# If we have ssize_t and socklen_t, the API is usually sane and uses ssize_t and size_t for lengths |
|
|
|
|
SET (RECVFROM_TYPE_RETV ssize_t) |
|
|
|
|
SET (RECVFROM_TYPE_ARG3 size_t) |
|
|
|
@ -354,14 +354,14 @@ ELSE () |
|
|
|
|
SET (RECVFROM_TYPE_ARG3 int) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
IF ("${HAVE_TYPE_SOCKET}") |
|
|
|
|
IF (HAVE_TYPE_SOCKET) |
|
|
|
|
# If the SOCKET type is defined, it uses socket ... should be windows only |
|
|
|
|
SET (RECVFROM_TYPE_ARG1 SOCKET) |
|
|
|
|
ELSE () |
|
|
|
|
SET (RECVFROM_TYPE_ARG1 int) |
|
|
|
|
ENDIF() |
|
|
|
|
|
|
|
|
|
IF ("${HAVE_SOCKLEN_T}") |
|
|
|
|
IF (HAVE_SOCKLEN_T) |
|
|
|
|
# If we have socklen_t the APIs pretty much always actually use it |
|
|
|
|
SET (RECVFROM_TYPE_ARG6 "socklen_t *") |
|
|
|
|
SET (GETNAMEINFO_TYPE_ARG2 socklen_t) |
|
|
|
@ -402,29 +402,29 @@ SET (SEND_TYPE_ARG4 int) |
|
|
|
|
# Set a few variables by hand that C-Ares wants, logically, based on detection |
|
|
|
|
# data. |
|
|
|
|
|
|
|
|
|
IF (${HAVE_SOCKLEN_T}) |
|
|
|
|
IF (HAVE_SOCKLEN_T) |
|
|
|
|
Set (CARES_TYPEOF_ARES_SOCKLEN_T "socklen_t") |
|
|
|
|
ELSE () |
|
|
|
|
Set (CARES_TYPEOF_ARES_SOCKLEN_T "int") |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
IF ("${HAVE_FCNTL}" AND "${HAVE_O_NONBLOCK}") |
|
|
|
|
IF (HAVE_FCNTL AND HAVE_O_NONBLOCK) |
|
|
|
|
SET (HAVE_FCNTL_O_NONBLOCK 1) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
IF ("${HAVE_IOCTL}" AND "${HAVE_FIONBIO}") |
|
|
|
|
IF (HAVE_IOCTL AND HAVE_FIONBIO) |
|
|
|
|
SET (HAVE_IOCTL_FIONBIO 1) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
IF ("${HAVE_IOCTLSOCKET}" AND "${HAVE_FIONBIO}") |
|
|
|
|
IF (HAVE_IOCTLSOCKET AND HAVE_FIONBIO) |
|
|
|
|
SET (HAVE_IOCTLSOCKET_FIONBIO 1) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
IF ("${HAVE_IOCTLSOCKET_CAMEL}" AND "${HAVE_FIONBIO}") |
|
|
|
|
IF (HAVE_IOCTLSOCKET_CAMEL AND HAVE_FIONBIO) |
|
|
|
|
SET (HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
IF (${HAVE_GETADDRINFO}) |
|
|
|
|
IF (HAVE_GETADDRINFO) |
|
|
|
|
IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR |
|
|
|
|
CMAKE_SYSTEM_NAME STREQUAL "HPUX" OR |
|
|
|
|
CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR |
|
|
|
@ -436,11 +436,11 @@ IF (${HAVE_GETADDRINFO}) |
|
|
|
|
ENDIF () |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
IF ("${HAVE_TIME_H}" AND "${HAVE_SYS_TIME_H}") |
|
|
|
|
IF (HAVE_TIME_H AND HAVE_SYS_TIME_H) |
|
|
|
|
SET (TIME_WITH_SYS_TIME 1) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
IF (${HAVE_GETSERVBYPORT_R}) |
|
|
|
|
IF (HAVE_GETSERVBYPORT_R) |
|
|
|
|
# TODO : Should probably autodetect |
|
|
|
|
IF (CMAKE_SYSTEM_NAME STREQUAL "SunOS") |
|
|
|
|
SET (GETSERVBYPORT_R_ARGS 5) |
|
|
|
@ -453,19 +453,19 @@ IF (${HAVE_GETSERVBYPORT_R}) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
# Set some aliases used for ares_build.h |
|
|
|
|
IF (${HAVE_SYS_TYPES_H}) |
|
|
|
|
IF (HAVE_SYS_TYPES_H) |
|
|
|
|
SET (CARES_HAVE_SYS_TYPES_H 1) |
|
|
|
|
ENDIF () |
|
|
|
|
IF (${HAVE_SYS_SOCKET_H}) |
|
|
|
|
IF (HAVE_SYS_SOCKET_H) |
|
|
|
|
SET (CARES_HAVE_SYS_SOCKET_H 1) |
|
|
|
|
ENDIF() |
|
|
|
|
IF (${HAVE_WS2TCPIP_H}) |
|
|
|
|
IF (HAVE_WS2TCPIP_H) |
|
|
|
|
SET (CARES_HAVE_WS2TCPIP_H 1) |
|
|
|
|
ENDIF() |
|
|
|
|
IF (${HAVE_WINSOCK2_H}) |
|
|
|
|
IF (HAVE_WINSOCK2_H) |
|
|
|
|
SET (CARES_HAVE_WINSOCK2_H 1) |
|
|
|
|
ENDIF() |
|
|
|
|
IF (${HAVE_WINDOWS_H}) |
|
|
|
|
IF (HAVE_WINDOWS_H) |
|
|
|
|
SET (CARES_HAVE_WINDOWS_H 1) |
|
|
|
|
ENDIF() |
|
|
|
|
|
|
|
|
@ -533,7 +533,7 @@ SET (CARES_SOURCES |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# Build the dynamic/shared library |
|
|
|
|
IF (${CARES_SHARED}) |
|
|
|
|
IF (CARES_SHARED) |
|
|
|
|
ADD_LIBRARY (${PROJECT_NAME} SHARED ${CARES_SOURCES}) |
|
|
|
|
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 -DCARES_BUILDING_LIBRARY") |
|
|
|
|
|
|
|
|
@ -550,7 +550,7 @@ IF (${CARES_SHARED}) |
|
|
|
|
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES SOVERSION "${CARES_LIB_VERSION_MAJOR}") |
|
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES (${PROJECT_NAME} ${CARES_DEPENDENT_LIBS}) |
|
|
|
|
IF (${CARES_INSTALL}) |
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
INSTALL (TARGETS ${PROJECT_NAME} DESTINATION ${CARES_INSTALL_LOCATION_LIBS}) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
@ -559,21 +559,21 @@ IF (${CARES_SHARED}) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
# Build the static library |
|
|
|
|
IF (${CARES_STATIC}) |
|
|
|
|
IF (CARES_STATIC) |
|
|
|
|
ADD_LIBRARY (${PROJECT_NAME}${STATIC_SUFFIX} STATIC ${CARES_SOURCES}) |
|
|
|
|
SET_TARGET_PROPERTIES (${PROJECT_NAME}${STATIC_SUFFIX} PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 -DCARES_STATICLIB" OUTPUT_NAME ${PROJECT_NAME}) |
|
|
|
|
IF (${CARES_STATIC_PIC}) |
|
|
|
|
IF (CARES_STATIC_PIC) |
|
|
|
|
SET_TARGET_PROPERTIES (${PROJECT_NAME}${STATIC_SUFFIX} PROPERTIES POSITION_INDEPENDENT_CODE True) |
|
|
|
|
ENDIF () |
|
|
|
|
TARGET_LINK_LIBRARIES (${PROJECT_NAME}${STATIC_SUFFIX} ${CARES_DEPENDENT_LIBS}) |
|
|
|
|
IF (${CARES_INSTALL}) |
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
INSTALL (TARGETS ${PROJECT_NAME}${STATIC_SUFFIX} DESTINATION ${CARES_INSTALL_LOCATION_LIBS}) |
|
|
|
|
ENDIF () |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Headers installation target |
|
|
|
|
IF (${CARES_INSTALL}) |
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
SET (CARES_HEADERS ares.h ares_version.h ares_dns.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_rules.h) |
|
|
|
|
INSTALL (FILES ${CARES_HEADERS} DESTINATION ${CARES_INSTALL_LOCATION_HEADERS}) |
|
|
|
|
ENDIF () |
|
|
|
@ -590,7 +590,7 @@ SET (CARES_EXAMPLE_SOURCES |
|
|
|
|
ADD_EXECUTABLE (ahost ahost.c ${CARES_EXAMPLE_SOURCES}) |
|
|
|
|
SET_TARGET_PROPERTIES(ahost PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 ${CARES_DEFINITIONS}") |
|
|
|
|
TARGET_LINK_LIBRARIES (ahost ${CARES_LIBRARIES} ${CARES_DEPENDENT_LIBS}) |
|
|
|
|
IF (${CARES_INSTALL}) |
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
INSTALL (TARGETS ahost RUNTIME DESTINATION ${CARES_INSTALL_LOCATION_BIN}) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
@ -599,7 +599,7 @@ ENDIF () |
|
|
|
|
ADD_EXECUTABLE (adig adig.c ${CARES_EXAMPLE_SOURCES}) |
|
|
|
|
SET_TARGET_PROPERTIES(adig PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 ${CARES_DEFINITIONS}") |
|
|
|
|
TARGET_LINK_LIBRARIES (adig ${CARES_LIBRARIES} ${CARES_DEPENDENT_LIBS}) |
|
|
|
|
IF (${CARES_INSTALL}) |
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
INSTALL (TARGETS adig RUNTIME DESTINATION ${CARES_INSTALL_LOCATION_BIN}) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
@ -608,6 +608,6 @@ ENDIF () |
|
|
|
|
ADD_EXECUTABLE (acountry acountry.c ${CARES_EXAMPLE_SOURCES}) |
|
|
|
|
SET_TARGET_PROPERTIES(acountry PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 ${CARES_DEFINITIONS}") |
|
|
|
|
TARGET_LINK_LIBRARIES (acountry ${CARES_LIBRARIES} ${CARES_DEPENDENT_LIBS}) |
|
|
|
|
IF (${CARES_INSTALL}) |
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
INSTALL (TARGETS acountry RUNTIME DESTINATION ${CARES_INSTALL_LOCATION_BIN}) |
|
|
|
|
ENDIF () |
|
|
|
|