"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
endif()
- message(STATUS "Performing Curl Test ${CURL_TEST}")
+ message(STATUS "Performing Test ${CURL_TEST}")
try_compile(${CURL_TEST}
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c
OUTPUT_VARIABLE OUTPUT)
if(${CURL_TEST})
set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}")
- message(STATUS "Performing Curl Test ${CURL_TEST} - Success")
+ message(STATUS "Performing Test ${CURL_TEST} - Success")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Performing Curl Test ${CURL_TEST} passed with the following output:\n"
+ "Performing Test ${CURL_TEST} passed with the following output:\n"
"${OUTPUT}\n")
else()
- message(STATUS "Performing Curl Test ${CURL_TEST} - Failed")
+ message(STATUS "Performing Test ${CURL_TEST} - Failed")
set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Performing Curl Test ${CURL_TEST} failed with the following output:\n"
+ "Performing Test ${CURL_TEST} failed with the following output:\n"
"${OUTPUT}\n")
endif()
endif()
include(CheckCSourceRuns)
include(CheckTypeSize)
-# The begin of the sources (macros and includes)
-set(_source_epilogue "#undef inline")
-
macro(add_header_include check header)
if(${check})
set(_source_epilogue "${_source_epilogue}
endif()
endmacro()
-if(WIN32)
- set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
- set(CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
- set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
-else()
- add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
- add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
-endif()
-
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
-check_c_source_compiles("${_source_epilogue}
- int main(void)
- {
- int flag = MSG_NOSIGNAL;
- (void)flag;
- return 0;
- }" HAVE_MSG_NOSIGNAL)
+if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
+ set(CMAKE_EXTRA_INCLUDE_FILES)
+ if(WIN32)
+ set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
+ set(CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
+ set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
+ elseif(HAVE_SYS_SOCKET_H)
+ set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
+ endif()
+ check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
+ set(HAVE_STRUCT_SOCKADDR_STORAGE ${HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE})
+endif()
if(NOT WIN32)
- add_header_include(HAVE_SYS_TIME_H "sys/time.h")
+ set(_source_epilogue "#undef inline")
+ add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
+ add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
+ check_c_source_compiles("${_source_epilogue}
+ int main(void)
+ {
+ int flag = MSG_NOSIGNAL;
+ (void)flag;
+ return 0;
+ }" HAVE_MSG_NOSIGNAL)
endif()
+
+set(_source_epilogue "#undef inline")
+add_header_include(HAVE_SYS_TIME_H "sys/time.h")
check_c_source_compiles("${_source_epilogue}
#include <time.h>
int main(void)
return 0;
}" HAVE_STRUCT_TIMEVAL)
-if(NOT WIN32)
- set(CMAKE_EXTRA_INCLUDE_FILES)
- if(HAVE_SYS_SOCKET_H)
- set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
- endif()
-endif()
-
-if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
- check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
- set(HAVE_STRUCT_SOCKADDR_STORAGE ${HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE})
-endif()
-
unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
-if(NOT CMAKE_CROSSCOMPILING)
- if(NOT APPLE)
- # only try this on non-apple platforms
-
- # if not cross-compilation...
- set(CMAKE_REQUIRED_FLAGS "")
- if(HAVE_SYS_POLL_H)
- set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H")
- elseif(HAVE_POLL_H)
- set(CMAKE_REQUIRED_FLAGS "-DHAVE_POLL_H")
- endif()
- check_c_source_runs("
- #include <stdlib.h>
- #include <sys/time.h>
-
- #ifdef HAVE_SYS_POLL_H
- # include <sys/poll.h>
- #elif HAVE_POLL_H
- # include <poll.h>
- #endif
-
- int main(void)
- {
- if(0 != poll(0, 0, 10)) {
- return 1; /* fail */
- }
- else {
- /* detect the 10.12 poll() breakage */
- struct timeval before, after;
- int rc;
- size_t us;
-
- gettimeofday(&before, NULL);
- rc = poll(NULL, 0, 500);
- gettimeofday(&after, NULL);
-
- us = (after.tv_sec - before.tv_sec) * 1000000 +
- (after.tv_usec - before.tv_usec);
-
- if(us < 400000) {
- return 1;
- }
+if(NOT CMAKE_CROSSCOMPILING AND NOT APPLE)
+ set(_source_epilogue "#undef inline")
+ add_header_include(HAVE_SYS_POLL_H "sys/poll.h")
+ add_header_include(HAVE_POLL_H "poll.h")
+ check_c_source_runs("${_source_epilogue}
+ #include <stdlib.h>
+ #include <sys/time.h>
+ int main(void)
+ {
+ if(0 != poll(0, 0, 10)) {
+ return 1; /* fail */
+ }
+ else {
+ /* detect the 10.12 poll() breakage */
+ struct timeval before, after;
+ int rc;
+ size_t us;
+
+ gettimeofday(&before, NULL);
+ rc = poll(NULL, 0, 500);
+ gettimeofday(&after, NULL);
+
+ us = (after.tv_sec - before.tv_sec) * 1000000 +
+ (after.tv_usec - before.tv_usec);
+
+ if(us < 400000) {
+ return 1;
}
- return 0;
- }" HAVE_POLL_FINE)
- endif()
+ }
+ return 0;
+ }" HAVE_POLL_FINE)
endif()
# Detect HAVE_GETADDRINFO_THREADSAFE
endif()
if(NOT DEFINED HAVE_GETADDRINFO_THREADSAFE)
-
- set(_save_epilogue "${_source_epilogue}")
set(_source_epilogue "#undef inline")
-
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
add_header_include(HAVE_NETDB_H "netdb.h")
-
check_c_source_compiles("${_source_epilogue}
int main(void)
{
if(HAVE_H_ERRNO OR HAVE_H_ERRNO_ASSIGNABLE OR HAVE_H_ERRNO_SBS_ISSUE_7)
set(HAVE_GETADDRINFO_THREADSAFE TRUE)
endif()
-
- set(_source_epilogue "${_save_epilogue}")
endif()
if(NOT WIN32 AND NOT DEFINED HAVE_CLOCK_GETTIME_MONOTONIC_RAW)
- set(_save_epilogue "${_source_epilogue}")
set(_source_epilogue "#undef inline")
-
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
-
check_c_source_compiles("${_source_epilogue}
#include <time.h>
int main(void)
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
return 0;
}" HAVE_CLOCK_GETTIME_MONOTONIC_RAW)
-
- set(_source_epilogue "${_save_epilogue}")
endif()