diff options
Diffstat (limited to 'Utilities/cmcurl/CMakeLists.txt')
-rw-r--r-- | Utilities/cmcurl/CMakeLists.txt | 115 |
1 files changed, 62 insertions, 53 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 4821656af..4fb93615c 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -8,6 +8,7 @@ set(CMAKE_USE_LIBSSH2 OFF CACHE INTERNAL "Disable curl libssh2") set(CMAKE_USE_LIBSSH OFF) set(CMAKE_USE_OPENLDAP OFF CACHE INTERNAL "No curl OpenLDAP") set(CURL_BROTLI OFF) +set(CURL_DISABLE_ALTSVC ON) set(CURL_DISABLE_COOKIES OFF CACHE INTERNAL "Do not disable curl cookie support") set(CURL_DISABLE_CRYPTO_AUTH OFF CACHE INTERNAL "Do not disable curl crypto auth") set(CURL_DISABLE_DICT ON CACHE INTERNAL "Disable curl dict protocol?") @@ -18,6 +19,8 @@ set(CURL_DISABLE_HTTP OFF CACHE INTERNAL "Disable curl http protocol?") set(CURL_DISABLE_IMAP ON CACHE INTERNAL "Disable curl imap protocol?") set(CURL_DISABLE_LDAP ON CACHE INTERNAL "Disable curl ldap protocol?") set(CURL_DISABLE_LDAPS ON CACHE INTERNAL "Disable curl ldaps protocol?") +set(CURL_DISABLE_MQTT ON) +set(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG OFF) set(CURL_DISABLE_POP3 ON CACHE INTERNAL "Disable curl pop3 protocol?") set(CURL_DISABLE_PROXY OFF CACHE INTERNAL "Do not disable curl proxy") set(CURL_DISABLE_RTSP ON CACHE INTERNAL "Disable curl rtsp protocol?") @@ -25,7 +28,6 @@ set(CURL_DISABLE_SMTP ON CACHE INTERNAL "Disable curl smtp protocol?") set(CURL_DISABLE_TELNET ON CACHE INTERNAL "Disable curl telnet protocol?") set(CURL_DISABLE_TFTP ON CACHE INTERNAL "Disable curl tftp protocol?") set(CURL_DISABLE_VERBOSE_STRINGS OFF CACHE INTERNAL "Do not disable curl verbosity") -set(CURL_ENABLE_MQTT OFF) set(CURL_HIDDEN_SYMBOLS OFF CACHE INTERNAL "No curl hidden symbols") set(CURL_LTO OFF CACHE INTERNAL "Turn on compiler Link Time Optimizations") set(CURL_STATIC_CRT OFF CACHE INTERNAL "Set to ON to build libcurl with static CRT on Windows (/MT).") @@ -40,9 +42,11 @@ set(ENABLE_INET_PTON OFF CACHE INTERNAL "Set to OFF to prevent usage of inet_pto set(ENABLE_IPV6 ON CACHE INTERNAL "Enable curl IPv6 support detection") set(ENABLE_MANUAL OFF CACHE INTERNAL "No curl built-in manual") set(ENABLE_THREADED_RESOLVER OFF CACHE INTERNAL "No curl POSIX threaded DNS lookup") +set(ENABLE_UNICODE OFF) set(ENABLE_UNIX_SOCKETS OFF CACHE INTERNAL "No curl Unix domain sockets support") set(HTTP_ONLY OFF CACHE INTERNAL "Curl is not http-only") set(PICKY_COMPILER OFF CACHE INTERNAL "Enable picky compiler options") +set(USE_LIBIDN2 ON) set(USE_NGHTTP2 ON) set(USE_NGTCP2 OFF) set(USE_QUICHE OFF) @@ -93,7 +97,7 @@ endif(APPLE) # Disable warnings to avoid changing 3rd party code. if(CMAKE_C_COMPILER_ID MATCHES - "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$") + "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM)$") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") @@ -106,11 +110,11 @@ endif() # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -146,10 +150,6 @@ include(CheckCCompilerFlag) project(CURL C) -if(0) # This code not needed for building within CMake. -message(WARNING "the curl cmake build system is poorly maintained. Be aware") -endif() - file(STRINGS ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS REGEX "#define LIBCURL_VERSION( |_NUM )") string(REGEX MATCH "#define LIBCURL_VERSION \"[^\"]*" CURL_VERSION ${CURL_VERSION_H_CONTENTS}) @@ -168,7 +168,7 @@ endif() # SET(PACKAGE_NAME "curl") # SET(PACKAGE_VERSION "-") # SET(PACKAGE_STRING "curl-") -# SET(PACKAGE_BUGREPORT "a suitable curl mailing list => https://curl.haxx.se/mail/") +# SET(PACKAGE_BUGREPORT "a suitable curl mailing list => https://curl.se/mail/") set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}") set(OS "\"${CMAKE_SYSTEM_NAME}\"") @@ -182,6 +182,7 @@ option(ENABLE_ARES "Set to ON to enable c-ares support" OFF) if(WIN32) option(CURL_STATIC_CRT "Set to ON to build libcurl with static CRT on Windows (/MT)." OFF) option(ENABLE_INET_PTON "Set to OFF to prevent usage of inet_pton when building against modern SDKs while still requiring compatibility with older Windows versions, such as Windows XP, Windows Server 2003 etc." ON) + option(ENABLE_UNICODE "Set to ON to use the Unicode version of the Windows API functions" OFF) if(0) # This code not needed for building within CMake. set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string") if(CURL_TARGET_WINDOWS_VERSION) @@ -197,6 +198,12 @@ if(WIN32) set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0501") endif() endif() + if(ENABLE_UNICODE) + add_definitions(-DUNICODE -D_UNICODE) + if(MINGW) + add_compile_options(-municode) + endif() + endif() endif() option(CURL_LTO "Turn on compiler Link Time Optimizations" OFF) @@ -294,28 +301,30 @@ option(CURL_DISABLE_SMTP "to disable SMTP" OFF) mark_as_advanced(CURL_DISABLE_SMTP) option(CURL_DISABLE_GOPHER "to disable Gopher" OFF) mark_as_advanced(CURL_DISABLE_GOPHER) -option(CURL_ENABLE_MQTT "to enable MQTT" OFF) -mark_as_advanced(CURL_ENABLE_MQTT) +option(CURL_DISABLE_MQTT "to disable MQTT" OFF) +mark_as_advanced(CURL_DISABLE_MQTT) if(HTTP_ONLY) + set(CURL_DISABLE_DICT ON) + set(CURL_DISABLE_FILE ON) set(CURL_DISABLE_FTP ON) + set(CURL_DISABLE_GOPHER ON) + set(CURL_DISABLE_IMAP ON) set(CURL_DISABLE_LDAP ON) set(CURL_DISABLE_LDAPS ON) - set(CURL_DISABLE_TELNET ON) - set(CURL_DISABLE_DICT ON) - set(CURL_DISABLE_FILE ON) - set(CURL_DISABLE_TFTP ON) - set(CURL_DISABLE_RTSP ON) + set(CURL_DISABLE_MQTT ON) set(CURL_DISABLE_POP3 ON) - set(CURL_DISABLE_IMAP ON) + set(CURL_DISABLE_RTSP ON) set(CURL_DISABLE_SMB ON) set(CURL_DISABLE_SMTP ON) - set(CURL_DISABLE_GOPHER ON) + set(CURL_DISABLE_TELNET ON) + set(CURL_DISABLE_TFTP ON) endif() +option(CURL_DISABLE_ALTSVC "to disable alt-svc support" OFF) +mark_as_advanced(CURL_DISABLE_ALTSVC) option(CURL_DISABLE_COOKIES "to disable cookies support" OFF) mark_as_advanced(CURL_DISABLE_COOKIES) - option(CURL_DISABLE_CRYPTO_AUTH "to disable cryptographic authentication" OFF) mark_as_advanced(CURL_DISABLE_CRYPTO_AUTH) option(CURL_DISABLE_VERBOSE_STRINGS "to disable verbose strings" OFF) @@ -352,10 +361,6 @@ if(ENABLE_MANUAL) endif() endif() -# We need ansi c-flags, especially on HP -set(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") -set(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS}) - if(CURL_STATIC_CRT) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") @@ -454,6 +459,7 @@ set(openssl_default ON) if(WIN32 OR CMAKE_USE_SECTRANSP OR CMAKE_USE_SCHANNEL OR CMAKE_USE_MBEDTLS OR CMAKE_USE_NSS OR CMAKE_USE_WOLFSSL) set(openssl_default OFF) endif() +option(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG "Disable automatic loading of OpenSSL configuration" OFF) count_true(enabled_ssl_options_count CMAKE_USE_SCHANNEL @@ -741,34 +747,35 @@ if(NOT CURL_DISABLE_LDAPS) endif() # Check for idn -check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2) +option(USE_LIBIDN2 "Use libidn2 for IDN support" ON) +set(HAVE_LIBIDN2 OFF) +if(USE_LIBIDN2) + check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2) +endif() # Check for symbol dlopen (same as HAVE_LIBDL) check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN) if(0) # This code not needed for building within CMake. -option(CURL_ZLIB "Set to ON to enable building curl with zlib support." ON) set(HAVE_LIBZ OFF) set(HAVE_ZLIB_H OFF) set(USE_ZLIB OFF) -if(CURL_ZLIB) - find_package(ZLIB QUIET) - if(ZLIB_FOUND) - set(HAVE_ZLIB_H ON) - set(HAVE_LIBZ ON) - set(USE_ZLIB ON) - - # Depend on ZLIB via imported targets if supported by the running - # version of CMake. This allows our dependents to get our dependencies - # transitively. - if(NOT CMAKE_VERSION VERSION_LESS 3.4) - list(APPEND CURL_LIBS ZLIB::ZLIB) - else() - list(APPEND CURL_LIBS ${ZLIB_LIBRARIES}) - include_directories(${ZLIB_INCLUDE_DIRS}) - endif() - list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) +optional_dependency(ZLIB) +if(ZLIB_FOUND) + set(HAVE_ZLIB_H ON) + set(HAVE_LIBZ ON) + set(USE_ZLIB ON) + + # Depend on ZLIB via imported targets if supported by the running + # version of CMake. This allows our dependents to get our dependencies + # transitively. + if(NOT CMAKE_VERSION VERSION_LESS 3.4) + list(APPEND CURL_LIBS ZLIB::ZLIB) + else() + list(APPEND CURL_LIBS ${ZLIB_LIBRARIES}) + include_directories(${ZLIB_INCLUDE_DIRS}) endif() + list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) endif() endif() @@ -911,6 +918,7 @@ if(CMAKE_USE_GSSAPI) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_COMPILER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GSS_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GSS_LINKER_FLAGS}") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${GSS_LINKER_FLAGS}") list(APPEND CURL_LIBS ${GSS_LIBRARIES}) else() @@ -926,8 +934,6 @@ else() unset(USE_UNIX_SOCKETS CACHE) endif() -option(ENABLE_ALT_SVC "Enable alt-svc support" OFF) -set(USE_ALTSVC ${ENABLE_ALT_SVC}) if(0) # This code not needed for building within CMake. # @@ -1055,6 +1061,7 @@ check_include_file_concat("net/if.h" HAVE_NET_IF_H) check_include_file_concat("netdb.h" HAVE_NETDB_H) check_include_file_concat("netinet/in.h" HAVE_NETINET_IN_H) check_include_file_concat("netinet/tcp.h" HAVE_NETINET_TCP_H) +check_include_file("linux/tcp.h" HAVE_LINUX_TCP_H) check_include_file_concat("pem.h" HAVE_PEM_H) check_include_file_concat("poll.h" HAVE_POLL_H) @@ -1465,16 +1472,16 @@ install(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmcurl) #----------------------------------------------------------------------------- if(0) # This code not needed for building within CMake. -option(BUILD_TESTING "Build tests" "${PERL_FOUND}") -if(NOT PERL_FOUND) - message(STATUS "Perl not found, testing disabled.") -elseif(BUILD_TESTING) +cmake_dependent_option(BUILD_TESTING "Build tests" + ON "PERL_FOUND;NOT CURL_DISABLE_TESTS" + OFF) +if(BUILD_TESTING) add_subdirectory(tests) endif() # NTLM support requires crypto function adaptions from various SSL libs # TODO alternative SSL libs tests for SSP1, GNUTLS, NSS -if(NOT CURL_DISABLE_CRYPTO_AUTH AND (USE_OPENSSL OR USE_WINDOWS_SSPI OR USE_DARWINSSL OR USE_MBEDTLS OR USE_WIN32_CRYPTO)) +if(NOT CURL_DISABLE_CRYPTO_AUTH AND (USE_OPENSSL OR USE_DARWINSSL OR USE_MBEDTLS OR USE_WIN32_CRYPTO)) set(use_ntlm ON) else() set(use_ntlm OFF) @@ -1493,7 +1500,7 @@ endmacro() set(_items) _add_if("SSL" SSL_ENABLED) _add_if("IPv6" ENABLE_IPV6) -_add_if("unix-sockets" USE_UNIX_SOCKETS) +_add_if("unixsockets" USE_UNIX_SOCKETS) _add_if("libz" HAVE_LIBZ) _add_if("brotli" HAVE_BROTLI) _add_if("zstd" HAVE_ZSTD) @@ -1504,7 +1511,7 @@ _add_if("Largefile" (CURL_SIZEOF_CURL_OFF_T GREATER 4) AND # TODO SSP1 (Schannel) check is missing _add_if("SSPI" USE_WINDOWS_SSPI) _add_if("GSS-API" HAVE_GSSAPI) -_add_if("alt-svc" ENABLE_ALT_SVC) +_add_if("alt-svc" NOT CURL_DISABLE_ALTSVC) # TODO SSP1 missing for SPNEGO _add_if("SPNEGO" NOT CURL_DISABLE_CRYPTO_AUTH AND (HAVE_GSSAPI OR USE_WINDOWS_SSPI)) @@ -1512,7 +1519,7 @@ _add_if("Kerberos" NOT CURL_DISABLE_CRYPTO_AUTH AND (HAVE_GSSAPI OR USE_WINDOWS_SSPI)) # NTLM support requires crypto function adaptions from various SSL libs # TODO alternative SSL libs tests for SSP1, GNUTLS, NSS -_add_if("NTLM" use_ntlm) +_add_if("NTLM" use_ntlm OR USE_WINDOWS_SSPI) # TODO missing option (autoconf: --enable-ntlm-wb) _add_if("NTLM_WB" use_ntlm AND NOT CURL_DISABLE_HTTP AND NTLM_WB_ENABLED) # TODO missing option (--enable-tls-srp), depends on GNUTLS_SRP/OPENSSL_SRP @@ -1522,6 +1529,7 @@ _add_if("HTTP2" USE_NGHTTP2) _add_if("HTTP3" USE_NGTCP2 OR USE_QUICHE) _add_if("MultiSSL" CURL_WITH_MULTI_SSL) _add_if("HTTPS-proxy" SSL_ENABLED AND (USE_OPENSSL OR USE_GNUTLS OR USE_NSS)) +_add_if("unicode" ENABLE_UNICODE) string(REPLACE ";" " " SUPPORT_FEATURES "${_items}") message(STATUS "Enabled features: ${SUPPORT_FEATURES}") @@ -1542,6 +1550,7 @@ _add_if("LDAPS" NOT CURL_DISABLE_LDAPS AND _add_if("DICT" NOT CURL_DISABLE_DICT) _add_if("TFTP" NOT CURL_DISABLE_TFTP) _add_if("GOPHER" NOT CURL_DISABLE_GOPHER) +_add_if("GOPHERS" NOT CURL_DISABLE_GOPHER AND SSL_ENABLED) _add_if("POP3" NOT CURL_DISABLE_POP3) _add_if("POP3S" NOT CURL_DISABLE_POP3 AND SSL_ENABLED) _add_if("IMAP" NOT CURL_DISABLE_IMAP) @@ -1554,7 +1563,7 @@ _add_if("SCP" USE_LIBSSH2 OR USE_LIBSSH) _add_if("SFTP" USE_LIBSSH2 OR USE_LIBSSH) _add_if("RTSP" NOT CURL_DISABLE_RTSP) _add_if("RTMP" USE_LIBRTMP) -_add_if("MQTT" CURL_ENABLE_MQTT) +_add_if("MQTT" NOT CURL_DISABLE_MQTT) if(_items) list(SORT _items) endif() |