CMake: remove redundant and old end-of-block syntax

Reviewed-by: Jakub Zakrzewski
Closes #2715
This commit is contained in:
Ruslan Baratov 2018-07-05 13:55:47 +03:00 committed by Daniel Stenberg
parent 685dc3c082
commit e0a4bba730
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
4 changed files with 96 additions and 102 deletions

View File

@ -10,8 +10,8 @@ macro(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
${VARIABLE}) ${VARIABLE})
if(${VARIABLE}) if(${VARIABLE})
set(CURL_LIBS ${LIBRARY} ${CURL_LIBS}) set(CURL_LIBS ${LIBRARY} ${CURL_LIBS})
endif(${VARIABLE}) endif()
endmacro(CHECK_LIBRARY_EXISTS_CONCAT) endmacro()
# Check if header file exists and add it to the list. # Check if header file exists and add it to the list.
# This macro is intended to be called multiple times with a sequence of # This macro is intended to be called multiple times with a sequence of
@ -22,8 +22,8 @@ macro(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
if(${VARIABLE}) if(${VARIABLE})
set(CURL_INCLUDES ${CURL_INCLUDES} ${FILE}) set(CURL_INCLUDES ${CURL_INCLUDES} ${FILE})
set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${VARIABLE}") set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${VARIABLE}")
endif(${VARIABLE}) endif()
endmacro(CHECK_INCLUDE_FILE_CONCAT) endmacro()
# For other curl specific tests, use this macro. # For other curl specific tests, use this macro.
macro(CURL_INTERNAL_TEST CURL_TEST) macro(CURL_INTERNAL_TEST CURL_TEST)
@ -33,7 +33,7 @@ macro(CURL_INTERNAL_TEST CURL_TEST)
if(CMAKE_REQUIRED_LIBRARIES) if(CMAKE_REQUIRED_LIBRARIES)
set(CURL_TEST_ADD_LIBRARIES set(CURL_TEST_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
endif(CMAKE_REQUIRED_LIBRARIES) endif()
message(STATUS "Performing Curl Test ${CURL_TEST}") message(STATUS "Performing Curl Test ${CURL_TEST}")
try_compile(${CURL_TEST} try_compile(${CURL_TEST}
@ -48,15 +48,15 @@ macro(CURL_INTERNAL_TEST CURL_TEST)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing Curl Test ${CURL_TEST} passed with the following output:\n" "Performing Curl Test ${CURL_TEST} passed with the following output:\n"
"${OUTPUT}\n") "${OUTPUT}\n")
else(${CURL_TEST}) else()
message(STATUS "Performing Curl Test ${CURL_TEST} - Failed") message(STATUS "Performing Curl Test ${CURL_TEST} - Failed")
set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing Curl Test ${CURL_TEST} failed with the following output:\n" "Performing Curl Test ${CURL_TEST} failed with the following output:\n"
"${OUTPUT}\n") "${OUTPUT}\n")
endif(${CURL_TEST}) endif()
endif() endif()
endmacro(CURL_INTERNAL_TEST) endmacro()
macro(CURL_INTERNAL_TEST_RUN CURL_TEST) macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
if(NOT DEFINED "${CURL_TEST}_COMPILE") if(NOT DEFINED "${CURL_TEST}_COMPILE")
@ -65,7 +65,7 @@ macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
if(CMAKE_REQUIRED_LIBRARIES) if(CMAKE_REQUIRED_LIBRARIES)
set(CURL_TEST_ADD_LIBRARIES set(CURL_TEST_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
endif(CMAKE_REQUIRED_LIBRARIES) endif()
message(STATUS "Performing Curl Test ${CURL_TEST}") message(STATUS "Performing Curl Test ${CURL_TEST}")
try_run(${CURL_TEST} ${CURL_TEST}_COMPILE try_run(${CURL_TEST} ${CURL_TEST}_COMPILE
@ -77,7 +77,7 @@ macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
if(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) if(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST})
set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}")
message(STATUS "Performing Curl Test ${CURL_TEST} - Success") message(STATUS "Performing Curl Test ${CURL_TEST} - Success")
else(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) else()
message(STATUS "Performing Curl Test ${CURL_TEST} - Failed") message(STATUS "Performing Curl Test ${CURL_TEST} - Failed")
set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}")
file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
@ -87,12 +87,12 @@ macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
file(APPEND file(APPEND
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
"There was a problem running this test\n") "There was a problem running this test\n")
endif(${CURL_TEST}_COMPILE) endif()
file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
"\n\n") "\n\n")
endif(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) endif()
endif() endif()
endmacro(CURL_INTERNAL_TEST_RUN) endmacro()
macro(CURL_NROFF_CHECK) macro(CURL_NROFF_CHECK)
find_program(NROFF NAMES gnroff nroff) find_program(NROFF NAMES gnroff nroff)
@ -121,4 +121,4 @@ macro(CURL_NROFF_CHECK)
else() else()
message(WARNING "Found no *nroff program") message(WARNING "Found no *nroff program")
endif() endif()
endmacro(CURL_NROFF_CHECK) endmacro()

View File

@ -5,8 +5,8 @@ set(_source_epilogue "#undef inline")
macro(add_header_include check header) macro(add_header_include check header)
if(${check}) if(${check})
set(_source_epilogue "${_source_epilogue}\n#include <${header}>") set(_source_epilogue "${_source_epilogue}\n#include <${header}>")
endif(${check}) endif()
endmacro(add_header_include) endmacro()
set(signature_call_conv) set(signature_call_conv)
if(HAVE_WINDOWS_H) if(HAVE_WINDOWS_H)
@ -19,10 +19,10 @@ if(HAVE_WINDOWS_H)
if(HAVE_LIBWS2_32) if(HAVE_LIBWS2_32)
set(CMAKE_REQUIRED_LIBRARIES ws2_32) set(CMAKE_REQUIRED_LIBRARIES ws2_32)
endif() endif()
else(HAVE_WINDOWS_H) else()
add_header_include(HAVE_SYS_TYPES_H "sys/types.h") add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h") add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
endif(HAVE_WINDOWS_H) endif()
check_c_source_compiles("${_source_epilogue} check_c_source_compiles("${_source_epilogue}
int main(void) { int main(void) {
@ -64,13 +64,13 @@ if(curl_cv_recv)
set(RECV_TYPE_RETV "${recv_retv}") set(RECV_TYPE_RETV "${recv_retv}")
set(HAVE_RECV 1) set(HAVE_RECV 1)
set(curl_cv_func_recv_done 1) set(curl_cv_func_recv_done 1)
endif(curl_cv_func_recv_test) endif()
endif(NOT curl_cv_func_recv_done) endif()
endforeach(recv_arg4) endforeach()
endforeach(recv_arg3) endforeach()
endforeach(recv_arg2) endforeach()
endforeach(recv_arg1) endforeach()
endforeach(recv_retv) endforeach()
else() else()
string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}") string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}")
string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${curl_cv_func_recv_args}") string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${curl_cv_func_recv_args}")
@ -81,10 +81,10 @@ if(curl_cv_recv)
if("${curl_cv_func_recv_args}" STREQUAL "unknown") if("${curl_cv_func_recv_args}" STREQUAL "unknown")
message(FATAL_ERROR "Cannot find proper types to use for recv args") message(FATAL_ERROR "Cannot find proper types to use for recv args")
endif("${curl_cv_func_recv_args}" STREQUAL "unknown") endif()
else(curl_cv_recv) else()
message(FATAL_ERROR "Unable to link function recv") message(FATAL_ERROR "Unable to link function recv")
endif(curl_cv_recv) endif()
set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv") set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
set(HAVE_RECV 1) set(HAVE_RECV 1)
@ -130,13 +130,13 @@ if(curl_cv_send)
set(SEND_TYPE_RETV "${send_retv}") set(SEND_TYPE_RETV "${send_retv}")
set(HAVE_SEND 1) set(HAVE_SEND 1)
set(curl_cv_func_send_done 1) set(curl_cv_func_send_done 1)
endif(curl_cv_func_send_test) endif()
endif(NOT curl_cv_func_send_done) endif()
endforeach(send_arg4) endforeach()
endforeach(send_arg3) endforeach()
endforeach(send_arg2) endforeach()
endforeach(send_arg1) endforeach()
endforeach(send_retv) endforeach()
else() else()
string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}") string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}")
string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${curl_cv_func_send_args}") string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${curl_cv_func_send_args}")
@ -148,11 +148,11 @@ if(curl_cv_send)
if("${curl_cv_func_send_args}" STREQUAL "unknown") if("${curl_cv_func_send_args}" STREQUAL "unknown")
message(FATAL_ERROR "Cannot find proper types to use for send args") message(FATAL_ERROR "Cannot find proper types to use for send args")
endif("${curl_cv_func_send_args}" STREQUAL "unknown") endif()
set(SEND_QUAL_ARG2 "const") set(SEND_QUAL_ARG2 "const")
else(curl_cv_send) else()
message(FATAL_ERROR "Unable to link function send") message(FATAL_ERROR "Unable to link function send")
endif(curl_cv_send) endif()
set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send") set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send")
set(HAVE_SEND 1) set(HAVE_SEND 1)
@ -184,7 +184,7 @@ if(NOT APPLE)
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
if(HAVE_SYS_POLL_H) if(HAVE_SYS_POLL_H)
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H") set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H")
endif(HAVE_SYS_POLL_H) endif()
check_c_source_runs(" check_c_source_runs("
#ifdef HAVE_SYS_POLL_H #ifdef HAVE_SYS_POLL_H
# include <sys/poll.h> # include <sys/poll.h>
@ -199,7 +199,7 @@ set(CMAKE_REQUIRED_FLAGS)
if(HAVE_SIGNAL_H) if(HAVE_SIGNAL_H)
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SIGNAL_H") set(CMAKE_REQUIRED_FLAGS "-DHAVE_SIGNAL_H")
set(CMAKE_EXTRA_INCLUDE_FILES "signal.h") set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
endif(HAVE_SIGNAL_H) endif()
check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T) check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
if(HAVE_SIZEOF_SIG_ATOMIC_T) if(HAVE_SIZEOF_SIG_ATOMIC_T)
check_c_source_compiles(" check_c_source_compiles("
@ -213,8 +213,8 @@ if(HAVE_SIZEOF_SIG_ATOMIC_T)
}" HAVE_SIG_ATOMIC_T_NOT_VOLATILE) }" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
set(HAVE_SIG_ATOMIC_T_VOLATILE 1) set(HAVE_SIG_ATOMIC_T_VOLATILE 1)
endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) endif()
endif(HAVE_SIZEOF_SIG_ATOMIC_T) endif()
if(HAVE_WINDOWS_H) if(HAVE_WINDOWS_H)
set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h) set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h)
@ -222,11 +222,10 @@ else()
set(CMAKE_EXTRA_INCLUDE_FILES) set(CMAKE_EXTRA_INCLUDE_FILES)
if(HAVE_SYS_SOCKET_H) if(HAVE_SYS_SOCKET_H)
set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h) set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
endif(HAVE_SYS_SOCKET_H) endif()
endif() endif()
check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE) check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
set(HAVE_STRUCT_SOCKADDR_STORAGE 1) set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) endif()

View File

@ -118,8 +118,7 @@ if(NOT UNIX)
set(HAVE_SIGACTION 0) set(HAVE_SIGACTION 0)
set(HAVE_MACRO_SIGSETJMP 0) set(HAVE_MACRO_SIGSETJMP 0)
else(WIN32) else()
message("This file should be included on Windows platform only") message("This file should be included on Windows platform only")
endif(WIN32) endif()
endif(NOT UNIX) endif()

View File

@ -100,8 +100,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}")
endif() endif()
endforeach() endforeach()
endif(PICKY_COMPILER) endif()
endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) endif()
if (ENABLE_DEBUG) if (ENABLE_DEBUG)
# DEBUGBUILD will be defined only for Debug builds # DEBUGBUILD will be defined only for Debug builds
@ -232,12 +232,12 @@ endif()
# Disable warnings on Borland to avoid changing 3rd party code. # Disable warnings on Borland to avoid changing 3rd party code.
if(BORLAND) if(BORLAND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
endif(BORLAND) endif()
# If we are on AIX, do the _ALL_SOURCE magic # If we are on AIX, do the _ALL_SOURCE magic
if(${CMAKE_SYSTEM_NAME} MATCHES AIX) if(${CMAKE_SYSTEM_NAME} MATCHES AIX)
set(_ALL_SOURCE 1) set(_ALL_SOURCE 1)
endif(${CMAKE_SYSTEM_NAME} MATCHES AIX) endif()
# Include all the necessary files for macros # Include all the necessary files for macros
include (CheckFunctionExists) include (CheckFunctionExists)
@ -253,7 +253,7 @@ include (CMakeDependentOption)
if(WIN32) if(WIN32)
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WINSOCKAPI_=") set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WINSOCKAPI_=")
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake)
endif(WIN32) endif()
if(ENABLE_THREADED_RESOLVER) if(ENABLE_THREADED_RESOLVER)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
@ -276,11 +276,11 @@ if(BEOS)
set(NOT_NEED_LIBNSL 1) set(NOT_NEED_LIBNSL 1)
check_library_exists_concat("bind" gethostbyname HAVE_LIBBIND) check_library_exists_concat("bind" gethostbyname HAVE_LIBBIND)
check_library_exists_concat("bnetapi" closesocket HAVE_LIBBNETAPI) check_library_exists_concat("bnetapi" closesocket HAVE_LIBBNETAPI)
endif(BEOS) endif()
if(NOT NOT_NEED_LIBNSL) if(NOT NOT_NEED_LIBNSL)
check_library_exists_concat("nsl" gethostbyname HAVE_LIBNSL) check_library_exists_concat("nsl" gethostbyname HAVE_LIBNSL)
endif(NOT NOT_NEED_LIBNSL) endif()
check_function_exists(gethostname HAVE_GETHOSTNAME) check_function_exists(gethostname HAVE_GETHOSTNAME)
@ -555,9 +555,8 @@ if(CMAKE_USE_LIBSSH2)
check_function_exists(libssh2_scp_send64 HAVE_LIBSSH2_SCP_SEND64) check_function_exists(libssh2_scp_send64 HAVE_LIBSSH2_SCP_SEND64)
check_function_exists(libssh2_session_handshake HAVE_LIBSSH2_SESSION_HANDSHAKE) check_function_exists(libssh2_session_handshake HAVE_LIBSSH2_SESSION_HANDSHAKE)
set(CMAKE_EXTRA_INCLUDE_FILES "") set(CMAKE_EXTRA_INCLUDE_FILES "")
endif()
endif(LIBSSH2_FOUND) endif()
endif(CMAKE_USE_LIBSSH2)
option(CMAKE_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is supported with CMake build)" OFF) option(CMAKE_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is supported with CMake build)" OFF)
mark_as_advanced(CMAKE_USE_GSSAPI) mark_as_advanced(CMAKE_USE_GSSAPI)
@ -708,7 +707,7 @@ if(NOT UNIX)
if(NOT CURL_WINDOWS_SSPI AND USE_OPENSSL) if(NOT CURL_WINDOWS_SSPI AND USE_OPENSSL)
set(CURL_LIBS ${CURL_LIBS} "crypt32") set(CURL_LIBS ${CURL_LIBS} "crypt32")
endif() endif()
endif(NOT UNIX) endif()
check_include_file_concat("stdio.h" HAVE_STDIO_H) check_include_file_concat("stdio.h" HAVE_STDIO_H)
check_include_file_concat("inttypes.h" HAVE_INTTYPES_H) check_include_file_concat("inttypes.h" HAVE_INTTYPES_H)
@ -791,17 +790,17 @@ check_type_size("time_t" SIZEOF_TIME_T)
if(NOT HAVE_SIZEOF_SSIZE_T) if(NOT HAVE_SIZEOF_SSIZE_T)
if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
set(ssize_t long) set(ssize_t long)
endif(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) endif()
if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
set(ssize_t __int64) set(ssize_t __int64)
endif(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) endif()
endif(NOT HAVE_SIZEOF_SSIZE_T) endif()
# off_t is sized later, after the HAVE_FILE_OFFSET_BITS test # off_t is sized later, after the HAVE_FILE_OFFSET_BITS test
if(HAVE_SIZEOF_LONG_LONG) if(HAVE_SIZEOF_LONG_LONG)
set(HAVE_LONGLONG 1) set(HAVE_LONGLONG 1)
set(HAVE_LL 1) set(HAVE_LL 1)
endif(HAVE_SIZEOF_LONG_LONG) endif()
find_file(RANDOM_FILE urandom /dev) find_file(RANDOM_FILE urandom /dev)
mark_as_advanced(RANDOM_FILE) mark_as_advanced(RANDOM_FILE)
@ -833,7 +832,7 @@ check_symbol_exists(strncmpi "${CURL_INCLUDES}" HAVE_STRNCMPI)
check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM) check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM)
if(NOT HAVE_STRNCMPI) if(NOT HAVE_STRNCMPI)
set(HAVE_STRCMPI) set(HAVE_STRCMPI)
endif(NOT HAVE_STRNCMPI) endif()
check_symbol_exists(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR) check_symbol_exists(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR)
check_symbol_exists(gethostbyaddr_r "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR_R) check_symbol_exists(gethostbyaddr_r "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR_R)
check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY) check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY)
@ -862,7 +861,7 @@ check_symbol_exists(signal "${CURL_INCLUDES}" HAVE_SIGNAL_FUNC)
check_symbol_exists(SIGALRM "${CURL_INCLUDES}" HAVE_SIGNAL_MACRO) check_symbol_exists(SIGALRM "${CURL_INCLUDES}" HAVE_SIGNAL_MACRO)
if(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO) if(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO)
set(HAVE_SIGNAL 1) set(HAVE_SIGNAL 1)
endif(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO) endif()
check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME) check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME)
check_symbol_exists(strtoll "${CURL_INCLUDES}" HAVE_STRTOLL) check_symbol_exists(strtoll "${CURL_INCLUDES}" HAVE_STRTOLL)
check_symbol_exists(_strtoi64 "${CURL_INCLUDES}" HAVE__STRTOI64) check_symbol_exists(_strtoi64 "${CURL_INCLUDES}" HAVE__STRTOI64)
@ -903,28 +902,28 @@ check_symbol_exists(fsetxattr "${CURL_INCLUDES}" HAVE_FSETXATTR)
if(HAVE_FSETXATTR) if(HAVE_FSETXATTR)
foreach(CURL_TEST HAVE_FSETXATTR_5 HAVE_FSETXATTR_6) foreach(CURL_TEST HAVE_FSETXATTR_5 HAVE_FSETXATTR_6)
curl_internal_test(${CURL_TEST}) curl_internal_test(${CURL_TEST})
endforeach(CURL_TEST) endforeach()
endif(HAVE_FSETXATTR) endif()
# sigaction and sigsetjmp are special. Use special mechanism for # sigaction and sigsetjmp are special. Use special mechanism for
# detecting those, but only if previous attempt failed. # detecting those, but only if previous attempt failed.
if(HAVE_SIGNAL_H) if(HAVE_SIGNAL_H)
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION) check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
endif(HAVE_SIGNAL_H) endif()
if(NOT HAVE_SIGSETJMP) if(NOT HAVE_SIGSETJMP)
if(HAVE_SETJMP_H) if(HAVE_SETJMP_H)
check_symbol_exists(sigsetjmp "setjmp.h" HAVE_MACRO_SIGSETJMP) check_symbol_exists(sigsetjmp "setjmp.h" HAVE_MACRO_SIGSETJMP)
if(HAVE_MACRO_SIGSETJMP) if(HAVE_MACRO_SIGSETJMP)
set(HAVE_SIGSETJMP 1) set(HAVE_SIGSETJMP 1)
endif(HAVE_MACRO_SIGSETJMP) endif()
endif(HAVE_SETJMP_H) endif()
endif(NOT HAVE_SIGSETJMP) endif()
# If there is no stricmp(), do not allow LDAP to parse URLs # If there is no stricmp(), do not allow LDAP to parse URLs
if(NOT HAVE_STRICMP) if(NOT HAVE_STRICMP)
set(HAVE_LDAP_URL_PARSE 1) set(HAVE_LDAP_URL_PARSE 1)
endif(NOT HAVE_STRICMP) endif()
# Do curl specific tests # Do curl specific tests
foreach(CURL_TEST foreach(CURL_TEST
@ -962,12 +961,12 @@ foreach(CURL_TEST
HAVE_FILE_OFFSET_BITS HAVE_FILE_OFFSET_BITS
) )
curl_internal_test(${CURL_TEST}) curl_internal_test(${CURL_TEST})
endforeach(CURL_TEST) endforeach()
if(HAVE_FILE_OFFSET_BITS) if(HAVE_FILE_OFFSET_BITS)
set(_FILE_OFFSET_BITS 64) set(_FILE_OFFSET_BITS 64)
set(CMAKE_REQUIRED_FLAGS "-D_FILE_OFFSET_BITS=64") set(CMAKE_REQUIRED_FLAGS "-D_FILE_OFFSET_BITS=64")
endif(HAVE_FILE_OFFSET_BITS) endif()
check_type_size("off_t" SIZEOF_OFF_T) check_type_size("off_t" SIZEOF_OFF_T)
# include this header to get the type # include this header to get the type
@ -983,7 +982,7 @@ foreach(CURL_TEST
HAVE_POSIX_STRERROR_R HAVE_POSIX_STRERROR_R
) )
curl_internal_test(${CURL_TEST}) curl_internal_test(${CURL_TEST})
endforeach(CURL_TEST) endforeach()
# Check for reentrant # Check for reentrant
foreach(CURL_TEST foreach(CURL_TEST
@ -997,9 +996,9 @@ foreach(CURL_TEST
if(NOT ${CURL_TEST}) if(NOT ${CURL_TEST})
if(${CURL_TEST}_REENTRANT) if(${CURL_TEST}_REENTRANT)
set(NEED_REENTRANT 1) set(NEED_REENTRANT 1)
endif(${CURL_TEST}_REENTRANT) endif()
endif(NOT ${CURL_TEST}) endif()
endforeach(CURL_TEST) endforeach()
if(NEED_REENTRANT) if(NEED_REENTRANT)
foreach(CURL_TEST foreach(CURL_TEST
@ -1012,32 +1011,32 @@ if(NEED_REENTRANT)
set(${CURL_TEST} 0) set(${CURL_TEST} 0)
if(${CURL_TEST}_REENTRANT) if(${CURL_TEST}_REENTRANT)
set(${CURL_TEST} 1) set(${CURL_TEST} 1)
endif(${CURL_TEST}_REENTRANT) endif()
endforeach(CURL_TEST) endforeach()
endif(NEED_REENTRANT) endif()
if(HAVE_INET_NTOA_R_DECL_REENTRANT) if(HAVE_INET_NTOA_R_DECL_REENTRANT)
set(HAVE_INET_NTOA_R_DECL 1) set(HAVE_INET_NTOA_R_DECL 1)
set(NEED_REENTRANT 1) set(NEED_REENTRANT 1)
endif(HAVE_INET_NTOA_R_DECL_REENTRANT) endif()
# Some other minor tests # Some other minor tests
if(NOT HAVE_IN_ADDR_T) if(NOT HAVE_IN_ADDR_T)
set(in_addr_t "unsigned long") set(in_addr_t "unsigned long")
endif(NOT HAVE_IN_ADDR_T) endif()
# Fix libz / zlib.h # Fix libz / zlib.h
if(NOT CURL_SPECIAL_LIBZ) if(NOT CURL_SPECIAL_LIBZ)
if(NOT HAVE_LIBZ) if(NOT HAVE_LIBZ)
set(HAVE_ZLIB_H 0) set(HAVE_ZLIB_H 0)
endif(NOT HAVE_LIBZ) endif()
if(NOT HAVE_ZLIB_H) if(NOT HAVE_ZLIB_H)
set(HAVE_LIBZ 0) set(HAVE_LIBZ 0)
endif(NOT HAVE_ZLIB_H) endif()
endif(NOT CURL_SPECIAL_LIBZ) endif()
# Check for nonblocking # Check for nonblocking
set(HAVE_DISABLED_NONBLOCKING 1) set(HAVE_DISABLED_NONBLOCKING 1)
@ -1046,16 +1045,13 @@ if(HAVE_FIONBIO OR
HAVE_IOCTLSOCKET_CASE OR HAVE_IOCTLSOCKET_CASE OR
HAVE_O_NONBLOCK) HAVE_O_NONBLOCK)
set(HAVE_DISABLED_NONBLOCKING) set(HAVE_DISABLED_NONBLOCKING)
endif(HAVE_FIONBIO OR endif()
HAVE_IOCTLSOCKET OR
HAVE_IOCTLSOCKET_CASE OR
HAVE_O_NONBLOCK)
if(RETSIGTYPE_TEST) if(RETSIGTYPE_TEST)
set(RETSIGTYPE void) set(RETSIGTYPE void)
else(RETSIGTYPE_TEST) else()
set(RETSIGTYPE int) set(RETSIGTYPE int)
endif(RETSIGTYPE_TEST) endif()
if(CMAKE_COMPILER_IS_GNUCC AND APPLE) if(CMAKE_COMPILER_IS_GNUCC AND APPLE)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
@ -1065,13 +1061,13 @@ if(CMAKE_COMPILER_IS_GNUCC AND APPLE)
get_source_file_property(MPRINTF_COMPILE_FLAGS mprintf.c COMPILE_FLAGS) get_source_file_property(MPRINTF_COMPILE_FLAGS mprintf.c COMPILE_FLAGS)
if(MPRINTF_COMPILE_FLAGS) if(MPRINTF_COMPILE_FLAGS)
set(MPRINTF_COMPILE_FLAGS "${MPRINTF_COMPILE_FLAGS} -Wno-long-double") set(MPRINTF_COMPILE_FLAGS "${MPRINTF_COMPILE_FLAGS} -Wno-long-double")
else(MPRINTF_COMPILE_FLAGS) else()
set(MPRINTF_COMPILE_FLAGS "-Wno-long-double") set(MPRINTF_COMPILE_FLAGS "-Wno-long-double")
endif(MPRINTF_COMPILE_FLAGS) endif()
set_source_files_properties(mprintf.c PROPERTIES set_source_files_properties(mprintf.c PROPERTIES
COMPILE_FLAGS ${MPRINTF_COMPILE_FLAGS}) COMPILE_FLAGS ${MPRINTF_COMPILE_FLAGS})
endif(HAVE_C_FLAG_Wno_long_double) endif()
endif(CMAKE_COMPILER_IS_GNUCC AND APPLE) endif()
if(HAVE_SOCKLEN_T) if(HAVE_SOCKLEN_T)
set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t") set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t")
@ -1112,7 +1108,7 @@ if(WIN32)
# Use the manifest embedded in the Windows Resource # Use the manifest embedded in the Windows Resource
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DCURL_EMBED_MANIFEST") set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DCURL_EMBED_MANIFEST")
endif(WIN32) endif()
if(MSVC) if(MSVC)
# Disable default manifest added by CMake # Disable default manifest added by CMake
@ -1121,10 +1117,10 @@ if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
if(CMAKE_C_FLAGS MATCHES "/W[0-4]") if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
else(CMAKE_C_FLAGS MATCHES "/W[0-4]") else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
endif(CMAKE_C_FLAGS MATCHES "/W[0-4]") endif()
endif(MSVC) endif()
if(CURL_WERROR) if(CURL_WERROR)
if(MSVC_VERSION) if(MSVC_VERSION)
@ -1133,7 +1129,7 @@ if(CURL_WERROR)
# this assumes clang or gcc style options # this assumes clang or gcc style options
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif() endif()
endif(CURL_WERROR) endif()
# Ugly (but functional) way to include "Makefile.inc" by transforming it (= regenerate it). # Ugly (but functional) way to include "Makefile.inc" by transforming it (= regenerate it).
function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE) function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE)