cmake: tidy-ups
- tidy-up comments. - use lowercase, underscore prefixed names for internal variables. - use `IN LISTS` and `IN ITEMS` in `foreach()` loops. - rename variable name `OUTPUT` to a more distinctive one. - tidy-up `STREQUAL` syntax. - delete commented code. - indent/whitespace. Closes #14197
This commit is contained in:
parent
b64d9d7d81
commit
acbc6b703f
@ -23,7 +23,7 @@
|
||||
###########################################################################
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
option(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that aren't officially external)." ON)
|
||||
option(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that are not officially external)." ON)
|
||||
mark_as_advanced(CURL_HIDDEN_SYMBOLS)
|
||||
|
||||
if(WIN32 AND (ENABLE_DEBUG OR ENABLE_CURLDEBUG))
|
||||
@ -42,7 +42,7 @@ if(CURL_HIDDEN_SYMBOLS)
|
||||
set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
|
||||
# note: this is considered buggy prior to 4.0 but the autotools don't care, so let's ignore that fact
|
||||
# Note: This is considered buggy prior to 4.0 but the autotools do not care, so let us ignore that fact
|
||||
set(SUPPORTS_SYMBOL_HIDING TRUE)
|
||||
set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))")
|
||||
set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
||||
@ -52,13 +52,13 @@ if(CURL_HIDDEN_SYMBOLS)
|
||||
set(_SYMBOL_EXTERN "__global")
|
||||
set(_CFLAG_SYMBOLS_HIDE "-xldscope=hidden")
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
# note: this should probably just check for version 9.1.045 but I'm not 100% sure
|
||||
# so let's do it the same way autotools do.
|
||||
# Note: This should probably just check for version 9.1.045 but I am not 100% sure
|
||||
# so let us do it the same way autotools do.
|
||||
set(SUPPORTS_SYMBOL_HIDING TRUE)
|
||||
set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))")
|
||||
set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
||||
check_c_source_compiles("#include <stdio.h>
|
||||
int main (void) { printf(\"icc fvisibility bug test\"); return 0; }" _no_bug)
|
||||
int main (void) { printf(\"icc fvisibility bug test\"); return 0; }" _no_bug)
|
||||
if(NOT _no_bug)
|
||||
set(SUPPORTS_SYMBOL_HIDING FALSE)
|
||||
set(_SYMBOL_EXTERN "")
|
||||
|
||||
@ -152,7 +152,7 @@ int main(void) { return 0; }
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#include <sys/types.h>
|
||||
/* Check that off_t can represent 2**63 - 1 correctly.
|
||||
We can't simply define LARGE_OFF_T to be 9223372036854775807,
|
||||
We cannot simply define LARGE_OFF_T to be 9223372036854775807,
|
||||
since some C++ compilers masquerading as C compilers
|
||||
incorrectly reject 9223372036854775807. */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
@ -337,7 +337,7 @@ int main(void)
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* float, because a pointer can't be implicitly cast to float */
|
||||
/* Float, because a pointer cannot be implicitly cast to float */
|
||||
void check(float f) {}
|
||||
|
||||
int main(void)
|
||||
|
||||
@ -35,7 +35,7 @@ find_path(CARES_INCLUDE_DIR ares.h)
|
||||
set(CARES_NAMES ${CARES_NAMES} cares)
|
||||
find_library(CARES_LIBRARY
|
||||
NAMES ${CARES_NAMES}
|
||||
)
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CARES
|
||||
@ -44,4 +44,4 @@ find_package_handle_standard_args(CARES
|
||||
mark_as_advanced(
|
||||
CARES_LIBRARY
|
||||
CARES_INCLUDE_DIR
|
||||
)
|
||||
)
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#
|
||||
###########################################################################
|
||||
# - Try to find the GSS Kerberos library
|
||||
# Once done this will define
|
||||
# Once done this defines
|
||||
#
|
||||
# GSS_ROOT_DIR - Set this variable to the root installation of GSS
|
||||
#
|
||||
@ -35,7 +35,7 @@
|
||||
# GSS_LINKER_FLAGS - Additional linker flags
|
||||
# GSS_COMPILER_FLAGS - Additional compiler flags
|
||||
# GSS_VERSION - This is set to version advertised by pkg-config or read from manifest.
|
||||
# In case the library is found but no version info available it'll be set to "unknown"
|
||||
# In case the library is found but no version info available it is set to "unknown"
|
||||
|
||||
set(_MIT_MODNAME mit-krb5-gssapi)
|
||||
set(_HEIMDAL_MODNAME heimdal-gssapi)
|
||||
@ -49,7 +49,7 @@ set(_GSS_ROOT_HINTS
|
||||
"$ENV{GSS_ROOT_DIR}"
|
||||
)
|
||||
|
||||
# try to find library using system pkg-config if user didn't specify root dir
|
||||
# Try to find library using system pkg-config if user did not specify root dir
|
||||
if(NOT GSS_ROOT_DIR AND NOT "$ENV{GSS_ROOT_DIR}")
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
@ -60,7 +60,7 @@ if(NOT GSS_ROOT_DIR AND NOT "$ENV{GSS_ROOT_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approach.
|
||||
if(NOT _GSS_FOUND) # Not found by pkg-config. Let us take more traditional approach.
|
||||
find_file(_GSS_CONFIGURE_SCRIPT
|
||||
NAMES
|
||||
"krb5-config"
|
||||
@ -72,7 +72,7 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
)
|
||||
|
||||
# if not found in user-supplied directories, maybe system knows better
|
||||
# If not found in user-supplied directories, maybe system knows better
|
||||
find_file(_GSS_CONFIGURE_SCRIPT
|
||||
NAMES
|
||||
"krb5-config"
|
||||
@ -86,10 +86,10 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
OUTPUT_VARIABLE _GSS_CFLAGS
|
||||
RESULT_VARIABLE _GSS_CONFIGURE_FAILED
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
)
|
||||
message(STATUS "CFLAGS: ${_GSS_CFLAGS}")
|
||||
if(NOT _GSS_CONFIGURE_FAILED) # 0 means success
|
||||
# should also work in an odd case when multiple directories are given
|
||||
if(NOT _GSS_CONFIGURE_FAILED) # 0 means success
|
||||
# Should also work in an odd case when multiple directories are given
|
||||
string(STRIP "${_GSS_CFLAGS}" _GSS_CFLAGS)
|
||||
string(REGEX REPLACE " +-I" ";" _GSS_CFLAGS "${_GSS_CFLAGS}")
|
||||
string(REGEX REPLACE " +-([^I][^ \\t;]*)" ";-\\1" _GSS_CFLAGS "${_GSS_CFLAGS}")
|
||||
@ -113,7 +113,7 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
message(STATUS "LDFLAGS: ${_GSS_LIB_FLAGS}")
|
||||
|
||||
if(NOT _GSS_CONFIGURE_FAILED) # 0 means success
|
||||
# this script gives us libraries and link directories. Blah. We have to deal with it.
|
||||
# This script gives us libraries and link directories. Blah. We have to deal with it.
|
||||
string(STRIP "${_GSS_LIB_FLAGS}" _GSS_LIB_FLAGS)
|
||||
string(REGEX REPLACE " +-(L|l)" ";-\\1" _GSS_LIB_FLAGS "${_GSS_LIB_FLAGS}")
|
||||
string(REGEX REPLACE " +-([^Ll][^ \\t;]*)" ";-\\1" _GSS_LIB_FLAGS "${_GSS_LIB_FLAGS}")
|
||||
@ -138,7 +138,7 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# older versions may not have the "--version" parameter. In this case we just don't care.
|
||||
# Older versions may not have the "--version" parameter. In this case we just do not care.
|
||||
if(_GSS_CONFIGURE_FAILED)
|
||||
set(_GSS_VERSION 0)
|
||||
endif()
|
||||
@ -150,9 +150,9 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# older versions may not have the "--vendor" parameter. In this case we just don't care.
|
||||
# Older versions may not have the "--vendor" parameter. In this case we just do not care.
|
||||
if(_GSS_CONFIGURE_FAILED)
|
||||
set(GSS_FLAVOUR "Heimdal") # most probably, shouldn't really matter
|
||||
set(GSS_FLAVOUR "Heimdal") # most probably, should not really matter
|
||||
else()
|
||||
if(_GSS_VENDOR MATCHES ".*H|heimdal.*")
|
||||
set(GSS_FLAVOUR "Heimdal")
|
||||
@ -161,7 +161,7 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else() # either there is no config script or we are on a platform that doesn't provide one (Windows?)
|
||||
else() # Either there is no config script or we are on a platform that does not provide one (Windows?)
|
||||
|
||||
find_path(_GSS_INCLUDE_DIR
|
||||
NAMES
|
||||
@ -173,14 +173,14 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
inc
|
||||
)
|
||||
|
||||
if(_GSS_INCLUDE_DIR) #jay, we've found something
|
||||
if(_GSS_INCLUDE_DIR) # jay, we have found something
|
||||
set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIR}")
|
||||
check_include_files( "gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _GSS_HAVE_MIT_HEADERS)
|
||||
|
||||
if(_GSS_HAVE_MIT_HEADERS)
|
||||
set(GSS_FLAVOUR "MIT")
|
||||
else()
|
||||
# prevent compiling the header - just check if we can include it
|
||||
# Prevent compiling the header - just check if we can include it
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D__ROKEN_H__)
|
||||
check_include_file( "roken.h" _GSS_HAVE_ROKEN_H)
|
||||
|
||||
@ -191,7 +191,7 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D__ROKEN_H__)
|
||||
endif()
|
||||
else()
|
||||
# I'm not convinced if this is the right way but this is what autotools do at the moment
|
||||
# I am not convinced if this is the right way but this is what autotools do at the moment
|
||||
find_path(_GSS_INCLUDE_DIR
|
||||
NAMES
|
||||
"gssapi.h"
|
||||
@ -207,7 +207,7 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if we have headers, check if we can link libraries
|
||||
# If we have headers, check if we can link libraries
|
||||
if(GSS_FLAVOUR)
|
||||
set(_GSS_LIBDIR_SUFFIXES "")
|
||||
set(_GSS_LIBDIR_HINTS ${_GSS_ROOT_HINTS})
|
||||
@ -231,7 +231,7 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
list(APPEND _GSS_LIBDIR_SUFFIXES "lib;lib64") # those suffixes are not checked for HINTS
|
||||
list(APPEND _GSS_LIBDIR_SUFFIXES "lib;lib64") # those suffixes are not checked for HINTS
|
||||
if(GSS_FLAVOUR STREQUAL "MIT")
|
||||
set(_GSS_LIBNAME "gssapi_krb5")
|
||||
else()
|
||||
@ -247,7 +247,6 @@ if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approac
|
||||
PATH_SUFFIXES
|
||||
${_GSS_LIBDIR_SUFFIXES}
|
||||
)
|
||||
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
@ -276,11 +275,11 @@ if(GSS_FLAVOUR)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}")
|
||||
file(STRINGS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}" heimdal_version_str
|
||||
REGEX "^.*version=\"[0-9]\\.[^\"]+\".*$")
|
||||
file(STRINGS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}" _heimdal_version_str
|
||||
REGEX "^.*version=\"[0-9]\\.[^\"]+\".*$")
|
||||
|
||||
string(REGEX MATCH "[0-9]\\.[^\"]+"
|
||||
GSS_VERSION "${heimdal_version_str}")
|
||||
GSS_VERSION "${_heimdal_version_str}")
|
||||
endif()
|
||||
|
||||
if(NOT GSS_VERSION)
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#
|
||||
###########################################################################
|
||||
# - Try to find the libpsl library
|
||||
# Once done this will define
|
||||
# Once done this defines
|
||||
#
|
||||
# LIBPSL_FOUND - system has the libpsl library
|
||||
# LIBPSL_INCLUDE_DIR - the libpsl include directory
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#
|
||||
###########################################################################
|
||||
# - Try to find the libssh2 library
|
||||
# Once done this will define
|
||||
# Once done this defines
|
||||
#
|
||||
# LIBSSH2_FOUND - system has the libssh2 library
|
||||
# LIBSSH2_INCLUDE_DIR - the libssh2 include directory
|
||||
|
||||
@ -21,23 +21,13 @@
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
# Find the msh3 library
|
||||
#
|
||||
# Result Variables:
|
||||
# MSH3_FOUND System has msh3
|
||||
# MSH3_INCLUDE_DIRS The msh3 include directories.
|
||||
# MSH3_LIBRARIES The libraries needed to use msh3
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindMSH3
|
||||
----------
|
||||
|
||||
Find the msh3 library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
``MSH3_FOUND``
|
||||
System has msh3
|
||||
``MSH3_INCLUDE_DIRS``
|
||||
The msh3 include directories.
|
||||
``MSH3_LIBRARIES``
|
||||
The libraries needed to use msh3
|
||||
#]=======================================================================]
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(PC_MSH3 libmsh3)
|
||||
|
||||
@ -21,25 +21,13 @@
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindNGHTTP3
|
||||
----------
|
||||
|
||||
Find the nghttp3 library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
``NGHTTP3_FOUND``
|
||||
System has nghttp3
|
||||
``NGHTTP3_INCLUDE_DIRS``
|
||||
The nghttp3 include directories.
|
||||
``NGHTTP3_LIBRARIES``
|
||||
The libraries needed to use nghttp3
|
||||
``NGHTTP3_VERSION``
|
||||
version of nghttp3.
|
||||
#]=======================================================================]
|
||||
# Find the nghttp3 library
|
||||
#
|
||||
# Result Variables:
|
||||
# NGHTTP3_FOUND System has nghttp3
|
||||
# NGHTTP3_INCLUDE_DIRS The nghttp3 include directories.
|
||||
# NGHTTP3_LIBRARIES The libraries needed to use nghttp3
|
||||
# NGHTTP3_VERSION version of nghttp3.
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
@ -21,33 +21,21 @@
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindNGTCP2
|
||||
----------
|
||||
|
||||
Find the ngtcp2 library
|
||||
|
||||
This module accepts optional COMPONENTS to control the crypto library (these are
|
||||
mutually exclusive)::
|
||||
|
||||
quictls, LibreSSL: Use libngtcp2_crypto_quictls
|
||||
BoringSSL, AWS-LC: Use libngtcp2_crypto_boringssl
|
||||
wolfSSL: Use libngtcp2_crypto_wolfssl
|
||||
GnuTLS: Use libngtcp2_crypto_gnutls
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
``NGTCP2_FOUND``
|
||||
System has ngtcp2
|
||||
``NGTCP2_INCLUDE_DIRS``
|
||||
The ngtcp2 include directories.
|
||||
``NGTCP2_LIBRARIES``
|
||||
The libraries needed to use ngtcp2
|
||||
``NGTCP2_VERSION``
|
||||
version of ngtcp2.
|
||||
#]=======================================================================]
|
||||
# Find the ngtcp2 library
|
||||
#
|
||||
# This module accepts optional COMPONENTS to control the crypto library (these are
|
||||
# mutually exclusive):
|
||||
#
|
||||
# quictls, LibreSSL: Use libngtcp2_crypto_quictls
|
||||
# BoringSSL, AWS-LC: Use libngtcp2_crypto_boringssl
|
||||
# wolfSSL: Use libngtcp2_crypto_wolfssl
|
||||
# GnuTLS: Use libngtcp2_crypto_gnutls
|
||||
#
|
||||
# Result Variables:
|
||||
# NGTCP2_FOUND System has ngtcp2
|
||||
# NGTCP2_INCLUDE_DIRS The ngtcp2 include directories.
|
||||
# NGTCP2_LIBRARIES The libraries needed to use ngtcp2
|
||||
# NGTCP2_VERSION version of ngtcp2.
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
@ -72,12 +60,12 @@ endif()
|
||||
|
||||
if(NGTCP2_FIND_COMPONENTS)
|
||||
set(NGTCP2_CRYPTO_BACKEND "")
|
||||
foreach(component IN LISTS NGTCP2_FIND_COMPONENTS)
|
||||
if(component MATCHES "^(BoringSSL|quictls|wolfSSL|GnuTLS)")
|
||||
foreach(_component IN LISTS NGTCP2_FIND_COMPONENTS)
|
||||
if(_component MATCHES "^(BoringSSL|quictls|wolfSSL|GnuTLS)")
|
||||
if(NGTCP2_CRYPTO_BACKEND)
|
||||
message(FATAL_ERROR "NGTCP2: Only one crypto library can be selected")
|
||||
endif()
|
||||
set(NGTCP2_CRYPTO_BACKEND ${component})
|
||||
set(NGTCP2_CRYPTO_BACKEND ${_component})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#
|
||||
###########################################################################
|
||||
# - Try to find the nettle library
|
||||
# Once done this will define
|
||||
# Once done this defines
|
||||
#
|
||||
# NETTLE_FOUND - system has nettle
|
||||
# NETTLE_INCLUDE_DIRS - nettle include directories
|
||||
|
||||
@ -21,23 +21,13 @@
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
# Find the quiche library
|
||||
#
|
||||
# Result Variables:
|
||||
# QUICHE_FOUND System has quiche
|
||||
# QUICHE_INCLUDE_DIRS The quiche include directories
|
||||
# QUICHE_LIBRARIES The libraries needed to use quiche
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindQUICHE
|
||||
----------
|
||||
|
||||
Find the quiche library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
``QUICHE_FOUND``
|
||||
System has quiche
|
||||
``QUICHE_INCLUDE_DIRS``
|
||||
The quiche include directories.
|
||||
``QUICHE_LIBRARIES``
|
||||
The libraries needed to use quiche
|
||||
#]=======================================================================]
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(PC_QUICHE quiche)
|
||||
|
||||
@ -21,23 +21,12 @@
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindZstd
|
||||
----------
|
||||
|
||||
Find the zstd library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
``Zstd_FOUND``
|
||||
System has zstd
|
||||
``Zstd_INCLUDE_DIRS``
|
||||
The zstd include directories.
|
||||
``Zstd_LIBRARIES``
|
||||
The libraries needed to use zstd
|
||||
#]=======================================================================]
|
||||
# Find the zstd library
|
||||
#
|
||||
# Result Variables
|
||||
# Zstd_FOUND System has zstd
|
||||
# Zstd_INCLUDE_DIRS The zstd include directories.
|
||||
# Zstd_LIBRARIES The libraries needed to use zstd
|
||||
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
@ -21,54 +21,55 @@
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
#File defines convenience macros for available feature testing
|
||||
# File defines convenience macros for available feature testing
|
||||
|
||||
# Check if header file exists and add it to the list.
|
||||
# This macro is intended to be called multiple times with a sequence of
|
||||
# possibly dependent header files. Some headers depend on others to be
|
||||
# compiled correctly.
|
||||
macro(check_include_file_concat FILE VARIABLE)
|
||||
check_include_files("${CURL_INCLUDES};${FILE}" ${VARIABLE})
|
||||
if(${VARIABLE})
|
||||
set(CURL_INCLUDES ${CURL_INCLUDES} ${FILE})
|
||||
set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${VARIABLE}")
|
||||
macro(check_include_file_concat file variable)
|
||||
check_include_files("${CURL_INCLUDES};${file}" ${variable})
|
||||
if(${variable})
|
||||
set(CURL_INCLUDES ${CURL_INCLUDES} ${file})
|
||||
set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${variable}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# For other curl specific tests, use this macro.
|
||||
macro(curl_internal_test CURL_TEST)
|
||||
if(NOT DEFINED "${CURL_TEST}")
|
||||
# Return result in variable: CURL_TEST_OUTPUT
|
||||
macro(curl_internal_test curl_test)
|
||||
if(NOT DEFINED "${curl_test}")
|
||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-D${CURL_TEST} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}")
|
||||
"-D${curl_test} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}")
|
||||
if(CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CURL_TEST_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Performing Test ${CURL_TEST}")
|
||||
try_compile(${CURL_TEST}
|
||||
message(STATUS "Performing Test ${curl_test}")
|
||||
try_compile(${curl_test}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
"${CURL_TEST_ADD_LIBRARIES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
if(${CURL_TEST})
|
||||
set(${CURL_TEST} 1 CACHE INTERNAL "Curl test")
|
||||
message(STATUS "Performing Test ${CURL_TEST} - Success")
|
||||
OUTPUT_VARIABLE CURL_TEST_OUTPUT)
|
||||
if(${curl_test})
|
||||
set(${curl_test} 1 CACHE INTERNAL "Curl test")
|
||||
message(STATUS "Performing Test ${curl_test} - Success")
|
||||
else()
|
||||
set(${CURL_TEST} "" CACHE INTERNAL "Curl test")
|
||||
message(STATUS "Performing Test ${CURL_TEST} - Failed")
|
||||
set(${curl_test} "" CACHE INTERNAL "Curl test")
|
||||
message(STATUS "Performing Test ${curl_test} - Failed")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(optional_dependency DEPENDENCY)
|
||||
set(CURL_${DEPENDENCY} AUTO CACHE STRING "Build curl with ${DEPENDENCY} support (AUTO, ON or OFF)")
|
||||
set_property(CACHE CURL_${DEPENDENCY} PROPERTY STRINGS AUTO ON OFF)
|
||||
macro(optional_dependency dependency)
|
||||
set(CURL_${dependency} AUTO CACHE STRING "Build curl with ${dependency} support (AUTO, ON or OFF)")
|
||||
set_property(CACHE CURL_${dependency} PROPERTY STRINGS AUTO ON OFF)
|
||||
|
||||
if(CURL_${DEPENDENCY} STREQUAL AUTO)
|
||||
find_package(${DEPENDENCY})
|
||||
elseif(CURL_${DEPENDENCY})
|
||||
find_package(${DEPENDENCY} REQUIRED)
|
||||
if(CURL_${dependency} STREQUAL AUTO)
|
||||
find_package(${dependency})
|
||||
elseif(CURL_${dependency})
|
||||
find_package(${dependency} REQUIRED)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@ -221,20 +221,20 @@ if(PICKY_COMPILER)
|
||||
|
||||
#
|
||||
|
||||
foreach(_CCOPT IN LISTS WPICKY_ENABLE)
|
||||
set(WPICKY "${WPICKY} ${_CCOPT}")
|
||||
foreach(_ccopt IN LISTS WPICKY_ENABLE)
|
||||
set(WPICKY "${WPICKY} ${_ccopt}")
|
||||
endforeach()
|
||||
|
||||
foreach(_CCOPT IN LISTS WPICKY_DETECT)
|
||||
foreach(_ccopt IN LISTS WPICKY_DETECT)
|
||||
# surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each new
|
||||
# test result in.
|
||||
string(MAKE_C_IDENTIFIER "OPT${_CCOPT}" _optvarname)
|
||||
string(MAKE_C_IDENTIFIER "OPT${_ccopt}" _optvarname)
|
||||
# GCC only warns about unknown -Wno- options if there are also other diagnostic messages,
|
||||
# so test for the positive form instead
|
||||
string(REPLACE "-Wno-" "-W" _CCOPT_ON "${_CCOPT}")
|
||||
check_c_compiler_flag(${_CCOPT_ON} ${_optvarname})
|
||||
string(REPLACE "-Wno-" "-W" _ccopt_on "${_ccopt}")
|
||||
check_c_compiler_flag(${_ccopt_on} ${_optvarname})
|
||||
if(${_optvarname})
|
||||
set(WPICKY "${WPICKY} ${_CCOPT}")
|
||||
set(WPICKY "${WPICKY} ${_ccopt}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@ -30,20 +30,20 @@ if(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
endif()
|
||||
message(${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" _files)
|
||||
string(REGEX REPLACE "\n" ";" _files "${_files}")
|
||||
foreach(_file ${_files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${_file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${_file}" OR EXISTS "$ENV{DESTDIR}${_file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${_file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${_file}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
message(STATUS "File $ENV{DESTDIR}${_file} does not exist.")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
438
CMakeLists.txt
438
CMakeLists.txt
@ -24,11 +24,11 @@
|
||||
# by Tetetest and Sukender (Benoit Neil)
|
||||
|
||||
# Note: By default this CMake build script detects the version of some
|
||||
# dependencies using `check_symbol_exists`. Those checks do not work
|
||||
# in the case that both CURL and its dependency are included as
|
||||
# sub-projects in a larger build using `FetchContent`. To support
|
||||
# that case, additional variables may be defined by the parent
|
||||
# project, ideally in the "extra" find package redirect file:
|
||||
# dependencies using `check_symbol_exists`. Those checks do not work in
|
||||
# the case that both CURL and its dependency are included as sub-projects
|
||||
# in a larger build using `FetchContent`. To support that case, additional
|
||||
# variables may be defined by the parent project, ideally in the "extra"
|
||||
# find package redirect file:
|
||||
# https://cmake.org/cmake/help/latest/module/FetchContent.html#integrating-with-find-package
|
||||
#
|
||||
# The following variables are available:
|
||||
@ -40,8 +40,8 @@
|
||||
# HAVE_ECH: ECH API checks for OpenSSL, BoringSSL or wolfSSL
|
||||
#
|
||||
# For each of the above variables, if the variable is DEFINED (either
|
||||
# to ON or OFF), the symbol detection will be skipped. If the
|
||||
# variable is NOT DEFINED, the symbol detection will be performed.
|
||||
# to ON or OFF), the symbol detection is skipped. If the variable is
|
||||
# NOT DEFINED, the symbol detection is performed.
|
||||
|
||||
cmake_minimum_required(VERSION 3.7...3.16 FATAL_ERROR)
|
||||
message(STATUS "Using CMake version ${CMAKE_VERSION}")
|
||||
@ -54,24 +54,16 @@ include(CheckCCompilerFlag)
|
||||
|
||||
project(CURL C)
|
||||
|
||||
file(STRINGS ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS REGEX "#define LIBCURL_VERSION( |_NUM )")
|
||||
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})
|
||||
CURL_VERSION ${_curl_version_h_contents})
|
||||
string(REGEX REPLACE "[^\"]+\"" "" CURL_VERSION ${CURL_VERSION})
|
||||
string(REGEX MATCH "#define LIBCURL_VERSION_NUM 0x[0-9a-fA-F]+"
|
||||
CURL_VERSION_NUM ${CURL_VERSION_H_CONTENTS})
|
||||
CURL_VERSION_NUM ${_curl_version_h_contents})
|
||||
string(REGEX REPLACE "[^0]+0x" "" CURL_VERSION_NUM ${CURL_VERSION_NUM})
|
||||
|
||||
|
||||
# Setup package meta-data
|
||||
# set(PACKAGE "curl")
|
||||
message(STATUS "curl version=[${CURL_VERSION}]")
|
||||
# set(PACKAGE_TARNAME "curl")
|
||||
# set(PACKAGE_NAME "curl")
|
||||
# set(PACKAGE_VERSION "-")
|
||||
# set(PACKAGE_STRING "curl-")
|
||||
# set(PACKAGE_BUGREPORT "a suitable curl mailing list => https://curl.se/mail/")
|
||||
set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
if(CMAKE_C_COMPILER_TARGET)
|
||||
set(OS "\"${CMAKE_C_COMPILER_TARGET}\"")
|
||||
else()
|
||||
@ -143,21 +135,21 @@ elseif(BUILD_STATIC_CURL AND NOT BUILD_STATIC_LIBS)
|
||||
set(BUILD_STATIC_CURL OFF)
|
||||
endif()
|
||||
|
||||
# lib flavour selected for curl tool
|
||||
# Lib flavour selected for curl tool
|
||||
if(BUILD_STATIC_CURL)
|
||||
set(LIB_SELECTED_FOR_EXE ${LIB_STATIC})
|
||||
else()
|
||||
set(LIB_SELECTED_FOR_EXE ${LIB_SHARED})
|
||||
endif()
|
||||
|
||||
# lib flavour selected for example and test programs.
|
||||
# Lib flavour selected for example and test programs.
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(LIB_SELECTED ${LIB_SHARED})
|
||||
else()
|
||||
set(LIB_SELECTED ${LIB_STATIC})
|
||||
endif()
|
||||
|
||||
# initialize CURL_LIBS
|
||||
# Initialize CURL_LIBS
|
||||
set(CURL_LIBS "")
|
||||
set(LIBCURL_PC_REQUIRES_PRIVATE "")
|
||||
|
||||
@ -197,8 +189,9 @@ option(CURL_DISABLE_DOH "disables DNS-over-HTTPS" OFF)
|
||||
mark_as_advanced(CURL_DISABLE_DOH)
|
||||
option(CURL_DISABLE_FILE "disables FILE" OFF)
|
||||
mark_as_advanced(CURL_DISABLE_FILE)
|
||||
cmake_dependent_option(CURL_DISABLE_FORM_API "disables form api" OFF
|
||||
"NOT CURL_DISABLE_MIME" ON)
|
||||
cmake_dependent_option(CURL_DISABLE_FORM_API "disables form api"
|
||||
OFF "NOT CURL_DISABLE_MIME"
|
||||
ON)
|
||||
mark_as_advanced(CURL_DISABLE_FORM_API)
|
||||
option(CURL_DISABLE_FTP "disables FTP" OFF)
|
||||
mark_as_advanced(CURL_DISABLE_FTP)
|
||||
@ -358,7 +351,7 @@ include(CheckSymbolExists)
|
||||
include(CheckTypeSize)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
# On windows preload settings
|
||||
# Preload settings on Windows
|
||||
if(WIN32)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake)
|
||||
endif()
|
||||
@ -386,7 +379,7 @@ if(WIN32)
|
||||
list(APPEND CURL_LIBS "ws2_32" "bcrypt")
|
||||
endif()
|
||||
|
||||
# check SSL libraries
|
||||
# Check SSL libraries
|
||||
option(CURL_ENABLE_SSL "Enable SSL support" ON)
|
||||
|
||||
if(CURL_DEFAULT_SSL_BACKEND)
|
||||
@ -405,11 +398,11 @@ cmake_dependent_option(CURL_USE_BEARSSL "Enable BearSSL for SSL/TLS" OFF CURL_EN
|
||||
cmake_dependent_option(CURL_USE_WOLFSSL "Enable wolfSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
|
||||
cmake_dependent_option(CURL_USE_GNUTLS "Enable GnuTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
|
||||
|
||||
set(openssl_default ON)
|
||||
set(_openssl_default ON)
|
||||
if(WIN32 OR CURL_USE_SECTRANSP OR CURL_USE_SCHANNEL OR CURL_USE_MBEDTLS OR CURL_USE_WOLFSSL)
|
||||
set(openssl_default OFF)
|
||||
set(_openssl_default OFF)
|
||||
endif()
|
||||
cmake_dependent_option(CURL_USE_OPENSSL "Enable OpenSSL for SSL/TLS" ${openssl_default} CURL_ENABLE_SSL OFF)
|
||||
cmake_dependent_option(CURL_USE_OPENSSL "Enable OpenSSL for SSL/TLS" ${_openssl_default} CURL_ENABLE_SSL OFF)
|
||||
option(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG "Disable automatic loading of OpenSSL configuration" OFF)
|
||||
|
||||
count_true(enabled_ssl_options_count
|
||||
@ -642,7 +635,7 @@ macro(openssl_check_symbol_exists SYMBOL FILES VARIABLE EXTRA_LIBS)
|
||||
endif()
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_UINTPTR_T) # to pull in stdint.h (as of wolfSSL v5.5.4)
|
||||
endif()
|
||||
if(NOT "${EXTRA_LIBS}" STREQUAL "")
|
||||
if(NOT EXTRA_LIBS STREQUAL "")
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${EXTRA_LIBS}")
|
||||
endif()
|
||||
check_symbol_exists("${SYMBOL}" "${FILES}" "${VARIABLE}")
|
||||
@ -821,7 +814,7 @@ if(NOT CURL_DISABLE_LDAP)
|
||||
set(CMAKE_LDAP_LIB "ldap" CACHE STRING "Name or full path to ldap library")
|
||||
set(CMAKE_LBER_LIB "lber" CACHE STRING "Name or full path to lber library")
|
||||
|
||||
# Now that we know, we're not using windows LDAP...
|
||||
# Now that we know, we are not using Windows LDAP...
|
||||
if(NOT USE_WIN32_LDAP)
|
||||
# Check for LDAP
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
|
||||
@ -837,34 +830,34 @@ if(NOT CURL_DISABLE_LDAP)
|
||||
if(CMAKE_LDAP_INCLUDE_DIR)
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_LDAP_INCLUDE_DIR})
|
||||
endif()
|
||||
check_include_file_concat("ldap.h" HAVE_LDAP_H)
|
||||
check_include_file_concat("lber.h" HAVE_LBER_H)
|
||||
check_include_file_concat("ldap.h" HAVE_LDAP_H)
|
||||
check_include_file_concat("lber.h" HAVE_LBER_H)
|
||||
|
||||
if(NOT HAVE_LDAP_H)
|
||||
message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON")
|
||||
set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) #LDAP includes won't be used
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) # LDAP includes will not be used
|
||||
elseif(NOT HAVE_LIBLDAP)
|
||||
message(STATUS "LDAP library '${CMAKE_LDAP_LIB}' not found CURL_DISABLE_LDAP set ON")
|
||||
set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) #LDAP includes won't be used
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_BAK}) # LDAP includes will not be used
|
||||
else()
|
||||
if(CMAKE_LDAP_INCLUDE_DIR)
|
||||
include_directories(${CMAKE_LDAP_INCLUDE_DIR})
|
||||
endif()
|
||||
set(NEED_LBER_H ON)
|
||||
set(_HEADER_LIST)
|
||||
set(_header_list)
|
||||
if(WIN32)
|
||||
list(APPEND _HEADER_LIST "windows.h")
|
||||
list(APPEND _header_list "windows.h")
|
||||
endif()
|
||||
if(HAVE_SYS_TYPES_H)
|
||||
list(APPEND _HEADER_LIST "sys/types.h")
|
||||
list(APPEND _header_list "sys/types.h")
|
||||
endif()
|
||||
list(APPEND _HEADER_LIST "ldap.h")
|
||||
list(APPEND _header_list "ldap.h")
|
||||
|
||||
set(_INCLUDE_STRING "")
|
||||
foreach(_HEADER ${_HEADER_LIST})
|
||||
set(_INCLUDE_STRING "${_INCLUDE_STRING}#include <${_HEADER}>\n")
|
||||
set(_include_string "")
|
||||
foreach(_header IN LISTS _header_list)
|
||||
set(_include_string "${_include_string}#include <${_header}>\n")
|
||||
endforeach()
|
||||
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DLDAP_DEPRECATED=1)
|
||||
@ -876,7 +869,7 @@ if(NOT CURL_DISABLE_LDAP)
|
||||
endif()
|
||||
|
||||
check_c_source_compiles("
|
||||
${_INCLUDE_STRING}
|
||||
${_include_string}
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
BerValue *bvp = NULL;
|
||||
@ -980,7 +973,7 @@ if(CURL_USE_LIBPSL)
|
||||
endif()
|
||||
|
||||
# libssh2
|
||||
option(CURL_USE_LIBSSH2 "Use libssh2" ON)
|
||||
option(CURL_USE_LIBSSH2 "Use libssh2" ON) # FIXME: default is OFF in autotools
|
||||
mark_as_advanced(CURL_USE_LIBSSH2)
|
||||
set(USE_LIBSSH2 OFF)
|
||||
|
||||
@ -1060,7 +1053,7 @@ if(CURL_USE_GSSAPI)
|
||||
string(REPLACE ";" " " _COMPILER_FLAGS_STR "${GSS_COMPILER_FLAGS}")
|
||||
string(REPLACE ";" " " _LINKER_FLAGS_STR "${GSS_LINKER_FLAGS}")
|
||||
|
||||
foreach(_dir ${GSS_LINK_DIRECTORIES})
|
||||
foreach(_dir IN LISTS GSS_LINK_DIRECTORIES)
|
||||
set(_LINKER_FLAGS_STR "${_LINKER_FLAGS_STR} -L\"${_dir}\"")
|
||||
endforeach()
|
||||
|
||||
@ -1128,13 +1121,13 @@ endif()
|
||||
#
|
||||
if(curl_ca_bundle_supported)
|
||||
set(CURL_CA_BUNDLE "auto" CACHE STRING
|
||||
"Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||
"Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||
set(CURL_CA_FALLBACK OFF CACHE BOOL
|
||||
"Set ON to use built-in CA store of TLS backend. Defaults to OFF")
|
||||
"Set ON to use built-in CA store of TLS backend. Defaults to OFF")
|
||||
set(CURL_CA_PATH "auto" CACHE STRING
|
||||
"Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||
"Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||
set(CURL_CA_EMBED "" CACHE STRING
|
||||
"Path to the CA bundle to embed into the curl tool.")
|
||||
"Path to the CA bundle to embed into the curl tool.")
|
||||
|
||||
if(CURL_CA_BUNDLE STREQUAL "")
|
||||
message(FATAL_ERROR "Invalid value of CURL_CA_BUNDLE. Use 'none', 'auto' or file path.")
|
||||
@ -1170,16 +1163,16 @@ if(curl_ca_bundle_supported)
|
||||
# First try auto-detecting a CA bundle, then a CA path
|
||||
|
||||
if(CURL_CA_BUNDLE_AUTODETECT)
|
||||
foreach(SEARCH_CA_BUNDLE_PATH IN ITEMS
|
||||
foreach(_search_ca_bundle_path IN ITEMS
|
||||
"/etc/ssl/certs/ca-certificates.crt"
|
||||
"/etc/pki/tls/certs/ca-bundle.crt"
|
||||
"/usr/share/ssl/certs/ca-bundle.crt"
|
||||
"/usr/local/share/certs/ca-root-nss.crt"
|
||||
"/etc/ssl/cert.pem")
|
||||
if(EXISTS "${SEARCH_CA_BUNDLE_PATH}")
|
||||
message(STATUS "Found CA bundle: ${SEARCH_CA_BUNDLE_PATH}")
|
||||
set(CURL_CA_BUNDLE "${SEARCH_CA_BUNDLE_PATH}" CACHE STRING
|
||||
"Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||
if(EXISTS "${_search_ca_bundle_path}")
|
||||
message(STATUS "Found CA bundle: ${_search_ca_bundle_path}")
|
||||
set(CURL_CA_BUNDLE "${_search_ca_bundle_path}" CACHE STRING
|
||||
"Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||
set(CURL_CA_BUNDLE_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
|
||||
break()
|
||||
endif()
|
||||
@ -1187,13 +1180,13 @@ if(curl_ca_bundle_supported)
|
||||
endif()
|
||||
|
||||
if(CURL_CA_PATH_AUTODETECT AND NOT CURL_CA_PATH_SET)
|
||||
set(SEARCH_CA_PATH "/etc/ssl/certs")
|
||||
file(GLOB curl_ca_files_found "${SEARCH_CA_PATH}/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].0")
|
||||
if(curl_ca_files_found)
|
||||
unset(curl_ca_files_found)
|
||||
message(STATUS "Found CA path: ${SEARCH_CA_PATH}")
|
||||
set(CURL_CA_PATH "${SEARCH_CA_PATH}" CACHE STRING
|
||||
"Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||
set(_search_ca_path "/etc/ssl/certs")
|
||||
file(GLOB _curl_ca_files_found "${_search_ca_path}/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].0")
|
||||
if(_curl_ca_files_found)
|
||||
unset(_curl_ca_files_found)
|
||||
message(STATUS "Found CA path: ${_search_ca_path}")
|
||||
set(CURL_CA_PATH "${_search_ca_path}" CACHE STRING
|
||||
"Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
|
||||
set(CURL_CA_PATH_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
|
||||
endif()
|
||||
endif()
|
||||
@ -1217,16 +1210,16 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# detect actual value of _WIN32_WINNT and store as HAVE_WIN32_WINNT
|
||||
# Detect actual value of _WIN32_WINNT and store as HAVE_WIN32_WINNT
|
||||
curl_internal_test(HAVE_WIN32_WINNT)
|
||||
if(HAVE_WIN32_WINNT)
|
||||
string(REGEX MATCH ".*_WIN32_WINNT=0x[0-9a-fA-F]+" OUTPUT "${OUTPUT}")
|
||||
string(REGEX REPLACE ".*_WIN32_WINNT=" "" OUTPUT "${OUTPUT}")
|
||||
string(REGEX REPLACE "0x([0-9a-f][0-9a-f][0-9a-f])$" "0x0\\1" OUTPUT "${OUTPUT}") # pad to 4 digits
|
||||
string(TOLOWER "${OUTPUT}" HAVE_WIN32_WINNT)
|
||||
string(REGEX MATCH ".*_WIN32_WINNT=0x[0-9a-fA-F]+" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
|
||||
string(REGEX REPLACE ".*_WIN32_WINNT=" "" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
|
||||
string(REGEX REPLACE "0x([0-9a-f][0-9a-f][0-9a-f])$" "0x0\\1" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}") # pad to 4 digits
|
||||
string(TOLOWER "${CURL_TEST_OUTPUT}" HAVE_WIN32_WINNT)
|
||||
message(STATUS "Found _WIN32_WINNT=${HAVE_WIN32_WINNT}")
|
||||
endif()
|
||||
# avoid storing HAVE_WIN32_WINNT in CMake cache
|
||||
# Avoid storing HAVE_WIN32_WINNT in CMake cache
|
||||
unset(HAVE_WIN32_WINNT CACHE)
|
||||
|
||||
if(HAVE_WIN32_WINNT)
|
||||
@ -1235,7 +1228,7 @@ if(WIN32)
|
||||
message(FATAL_ERROR "Building for Windows XP or newer is required.")
|
||||
endif()
|
||||
|
||||
# pre-fill detection results based on target OS version
|
||||
# Pre-fill detection results based on target OS version
|
||||
if(MINGW OR MSVC)
|
||||
if(HAVE_WIN32_WINNT STRLESS "0x0600")
|
||||
set(HAVE_INET_NTOP 0)
|
||||
@ -1328,92 +1321,92 @@ elseif(HAVE_LIBSOCKET)
|
||||
set(CMAKE_REQUIRED_LIBRARIES socket)
|
||||
endif()
|
||||
|
||||
check_symbol_exists(fnmatch "${CURL_INCLUDES};fnmatch.h" HAVE_FNMATCH)
|
||||
check_symbol_exists(basename "${CURL_INCLUDES};string.h" HAVE_BASENAME)
|
||||
check_symbol_exists(opendir "${CURL_INCLUDES};dirent.h" HAVE_OPENDIR)
|
||||
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
||||
check_symbol_exists(sched_yield "${CURL_INCLUDES};sched.h" HAVE_SCHED_YIELD)
|
||||
check_symbol_exists(socketpair "${CURL_INCLUDES}" HAVE_SOCKETPAIR)
|
||||
check_symbol_exists(recv "${CURL_INCLUDES}" HAVE_RECV)
|
||||
check_symbol_exists(send "${CURL_INCLUDES}" HAVE_SEND)
|
||||
check_symbol_exists(sendmsg "${CURL_INCLUDES}" HAVE_SENDMSG)
|
||||
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
||||
check_symbol_exists(strdup "${CURL_INCLUDES};string.h" HAVE_STRDUP)
|
||||
check_symbol_exists(strtok_r "${CURL_INCLUDES};string.h" HAVE_STRTOK_R)
|
||||
check_symbol_exists(strcasecmp "${CURL_INCLUDES};string.h" HAVE_STRCASECMP)
|
||||
check_symbol_exists(stricmp "${CURL_INCLUDES};string.h" HAVE_STRICMP)
|
||||
check_symbol_exists(strcmpi "${CURL_INCLUDES};string.h" HAVE_STRCMPI)
|
||||
check_symbol_exists(memrchr "${CURL_INCLUDES};string.h" HAVE_MEMRCHR)
|
||||
check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM)
|
||||
check_symbol_exists(arc4random "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
|
||||
check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL)
|
||||
check_symbol_exists(getppid "${CURL_INCLUDES}" HAVE_GETPPID)
|
||||
check_symbol_exists(utimes "${CURL_INCLUDES}" HAVE_UTIMES)
|
||||
check_symbol_exists(fnmatch "${CURL_INCLUDES};fnmatch.h" HAVE_FNMATCH)
|
||||
check_symbol_exists(basename "${CURL_INCLUDES};string.h" HAVE_BASENAME)
|
||||
check_symbol_exists(opendir "${CURL_INCLUDES};dirent.h" HAVE_OPENDIR)
|
||||
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
||||
check_symbol_exists(sched_yield "${CURL_INCLUDES};sched.h" HAVE_SCHED_YIELD)
|
||||
check_symbol_exists(socketpair "${CURL_INCLUDES}" HAVE_SOCKETPAIR)
|
||||
check_symbol_exists(recv "${CURL_INCLUDES}" HAVE_RECV)
|
||||
check_symbol_exists(send "${CURL_INCLUDES}" HAVE_SEND)
|
||||
check_symbol_exists(sendmsg "${CURL_INCLUDES}" HAVE_SENDMSG)
|
||||
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
||||
check_symbol_exists(strdup "${CURL_INCLUDES};string.h" HAVE_STRDUP)
|
||||
check_symbol_exists(strtok_r "${CURL_INCLUDES};string.h" HAVE_STRTOK_R)
|
||||
check_symbol_exists(strcasecmp "${CURL_INCLUDES};string.h" HAVE_STRCASECMP)
|
||||
check_symbol_exists(stricmp "${CURL_INCLUDES};string.h" HAVE_STRICMP)
|
||||
check_symbol_exists(strcmpi "${CURL_INCLUDES};string.h" HAVE_STRCMPI)
|
||||
check_symbol_exists(memrchr "${CURL_INCLUDES};string.h" HAVE_MEMRCHR)
|
||||
check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM)
|
||||
check_symbol_exists(arc4random "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
|
||||
check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL)
|
||||
check_symbol_exists(getppid "${CURL_INCLUDES}" HAVE_GETPPID)
|
||||
check_symbol_exists(utimes "${CURL_INCLUDES}" HAVE_UTIMES)
|
||||
|
||||
check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY)
|
||||
check_symbol_exists(closesocket "${CURL_INCLUDES}" HAVE_CLOSESOCKET)
|
||||
check_symbol_exists(sigsetjmp "${CURL_INCLUDES};setjmp.h" HAVE_SIGSETJMP)
|
||||
check_symbol_exists(getpass_r "${CURL_INCLUDES}" HAVE_GETPASS_R)
|
||||
check_symbol_exists(getpwuid "${CURL_INCLUDES}" HAVE_GETPWUID)
|
||||
check_symbol_exists(getpwuid_r "${CURL_INCLUDES}" HAVE_GETPWUID_R)
|
||||
check_symbol_exists(geteuid "${CURL_INCLUDES}" HAVE_GETEUID)
|
||||
check_symbol_exists(utime "${CURL_INCLUDES}" HAVE_UTIME)
|
||||
check_symbol_exists(gmtime_r "${CURL_INCLUDES};stdlib.h;time.h" HAVE_GMTIME_R)
|
||||
check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY)
|
||||
check_symbol_exists(closesocket "${CURL_INCLUDES}" HAVE_CLOSESOCKET)
|
||||
check_symbol_exists(sigsetjmp "${CURL_INCLUDES};setjmp.h" HAVE_SIGSETJMP)
|
||||
check_symbol_exists(getpass_r "${CURL_INCLUDES}" HAVE_GETPASS_R)
|
||||
check_symbol_exists(getpwuid "${CURL_INCLUDES}" HAVE_GETPWUID)
|
||||
check_symbol_exists(getpwuid_r "${CURL_INCLUDES}" HAVE_GETPWUID_R)
|
||||
check_symbol_exists(geteuid "${CURL_INCLUDES}" HAVE_GETEUID)
|
||||
check_symbol_exists(utime "${CURL_INCLUDES}" HAVE_UTIME)
|
||||
check_symbol_exists(gmtime_r "${CURL_INCLUDES};stdlib.h;time.h" HAVE_GMTIME_R)
|
||||
|
||||
check_symbol_exists(gethostbyname_r "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME_R)
|
||||
|
||||
check_symbol_exists(signal "${CURL_INCLUDES};signal.h" HAVE_SIGNAL)
|
||||
check_symbol_exists(strtoll "${CURL_INCLUDES};stdlib.h" HAVE_STRTOLL)
|
||||
check_symbol_exists(strerror_r "${CURL_INCLUDES};stdlib.h;string.h" HAVE_STRERROR_R)
|
||||
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
check_symbol_exists(siginterrupt "${CURL_INCLUDES};signal.h" HAVE_SIGINTERRUPT)
|
||||
check_symbol_exists(getaddrinfo "${CURL_INCLUDES};stdlib.h;string.h" HAVE_GETADDRINFO)
|
||||
check_symbol_exists(getifaddrs "${CURL_INCLUDES};stdlib.h" HAVE_GETIFADDRS)
|
||||
check_symbol_exists(freeaddrinfo "${CURL_INCLUDES}" HAVE_FREEADDRINFO)
|
||||
check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE)
|
||||
check_symbol_exists(eventfd "${CURL_INCLUDES};sys/eventfd.h" HAVE_EVENTFD)
|
||||
check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE)
|
||||
check_symbol_exists(_fseeki64 "${CURL_INCLUDES};stdio.h" HAVE__FSEEKI64)
|
||||
check_symbol_exists(getpeername "${CURL_INCLUDES}" HAVE_GETPEERNAME)
|
||||
check_symbol_exists(getsockname "${CURL_INCLUDES}" HAVE_GETSOCKNAME)
|
||||
check_symbol_exists(if_nametoindex "${CURL_INCLUDES}" HAVE_IF_NAMETOINDEX)
|
||||
check_symbol_exists(getrlimit "${CURL_INCLUDES}" HAVE_GETRLIMIT)
|
||||
check_symbol_exists(setlocale "${CURL_INCLUDES}" HAVE_SETLOCALE)
|
||||
check_symbol_exists(setmode "${CURL_INCLUDES}" HAVE_SETMODE)
|
||||
check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT)
|
||||
check_symbol_exists(signal "${CURL_INCLUDES};signal.h" HAVE_SIGNAL)
|
||||
check_symbol_exists(strtoll "${CURL_INCLUDES};stdlib.h" HAVE_STRTOLL)
|
||||
check_symbol_exists(strerror_r "${CURL_INCLUDES};stdlib.h;string.h" HAVE_STRERROR_R)
|
||||
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
check_symbol_exists(siginterrupt "${CURL_INCLUDES};signal.h" HAVE_SIGINTERRUPT)
|
||||
check_symbol_exists(getaddrinfo "${CURL_INCLUDES};stdlib.h;string.h" HAVE_GETADDRINFO)
|
||||
check_symbol_exists(getifaddrs "${CURL_INCLUDES};stdlib.h" HAVE_GETIFADDRS)
|
||||
check_symbol_exists(freeaddrinfo "${CURL_INCLUDES}" HAVE_FREEADDRINFO)
|
||||
check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE)
|
||||
check_symbol_exists(eventfd "${CURL_INCLUDES};sys/eventfd.h" HAVE_EVENTFD)
|
||||
check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE)
|
||||
check_symbol_exists(_fseeki64 "${CURL_INCLUDES};stdio.h" HAVE__FSEEKI64)
|
||||
check_symbol_exists(getpeername "${CURL_INCLUDES}" HAVE_GETPEERNAME)
|
||||
check_symbol_exists(getsockname "${CURL_INCLUDES}" HAVE_GETSOCKNAME)
|
||||
check_symbol_exists(if_nametoindex "${CURL_INCLUDES}" HAVE_IF_NAMETOINDEX)
|
||||
check_symbol_exists(getrlimit "${CURL_INCLUDES}" HAVE_GETRLIMIT)
|
||||
check_symbol_exists(setlocale "${CURL_INCLUDES}" HAVE_SETLOCALE)
|
||||
check_symbol_exists(setmode "${CURL_INCLUDES}" HAVE_SETMODE)
|
||||
check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT)
|
||||
|
||||
if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1900))
|
||||
# earlier MSVC compilers had faulty snprintf implementations
|
||||
check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
|
||||
# Earlier MSVC compilers had faulty snprintf implementations
|
||||
check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
|
||||
endif()
|
||||
check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
|
||||
check_symbol_exists(inet_ntop "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP)
|
||||
check_symbol_exists(inet_ntop "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP)
|
||||
if(MSVC AND (MSVC_VERSION LESS_EQUAL 1600))
|
||||
set(HAVE_INET_NTOP OFF)
|
||||
endif()
|
||||
check_symbol_exists(inet_pton "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON)
|
||||
check_symbol_exists(inet_pton "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON)
|
||||
|
||||
check_symbol_exists(fsetxattr "${CURL_INCLUDES}" HAVE_FSETXATTR)
|
||||
if(HAVE_FSETXATTR)
|
||||
foreach(CURL_TEST HAVE_FSETXATTR_5 HAVE_FSETXATTR_6)
|
||||
curl_internal_test(${CURL_TEST})
|
||||
foreach(_curl_test IN ITEMS HAVE_FSETXATTR_5 HAVE_FSETXATTR_6)
|
||||
curl_internal_test(${_curl_test})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
|
||||
check_type_size("sa_family_t" SIZEOF_SA_FAMILY_T)
|
||||
set(HAVE_SA_FAMILY_T ${HAVE_SIZEOF_SA_FAMILY_T})
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "")
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
|
||||
check_type_size("sa_family_t" SIZEOF_SA_FAMILY_T)
|
||||
set(HAVE_SA_FAMILY_T ${HAVE_SIZEOF_SA_FAMILY_T})
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "")
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
|
||||
check_type_size("ADDRESS_FAMILY" SIZEOF_ADDRESS_FAMILY)
|
||||
set(HAVE_ADDRESS_FAMILY ${HAVE_SIZEOF_ADDRESS_FAMILY})
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "")
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
|
||||
check_type_size("ADDRESS_FAMILY" SIZEOF_ADDRESS_FAMILY)
|
||||
set(HAVE_ADDRESS_FAMILY ${HAVE_SIZEOF_ADDRESS_FAMILY})
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "")
|
||||
endif()
|
||||
|
||||
# Do curl specific tests
|
||||
foreach(CURL_TEST
|
||||
foreach(_curl_test IN ITEMS
|
||||
HAVE_FCNTL_O_NONBLOCK
|
||||
HAVE_IOCTLSOCKET
|
||||
HAVE_IOCTLSOCKET_CAMEL
|
||||
@ -1435,34 +1428,34 @@ foreach(CURL_TEST
|
||||
HAVE_FILE_OFFSET_BITS
|
||||
HAVE_ATOMIC
|
||||
)
|
||||
curl_internal_test(${CURL_TEST})
|
||||
curl_internal_test(${_curl_test})
|
||||
endforeach()
|
||||
|
||||
if(HAVE_FILE_OFFSET_BITS)
|
||||
set(_FILE_OFFSET_BITS 64)
|
||||
set(CMAKE_REQUIRED_FLAGS "-D_FILE_OFFSET_BITS=64")
|
||||
endif()
|
||||
check_type_size("off_t" SIZEOF_OFF_T)
|
||||
check_type_size("off_t" SIZEOF_OFF_T)
|
||||
|
||||
# fseeko may not exist with _FILE_OFFSET_BITS=64 but can exist with
|
||||
# _FILE_OFFSET_BITS unset or 32 (e.g. Android ARMv7 with NDK 26b and API level < 24)
|
||||
# so we need to test fseeko after testing for _FILE_OFFSET_BITS
|
||||
check_symbol_exists(fseeko "${CURL_INCLUDES};stdio.h" HAVE_FSEEKO)
|
||||
check_symbol_exists(fseeko "${CURL_INCLUDES};stdio.h" HAVE_FSEEKO)
|
||||
|
||||
if(HAVE_FSEEKO)
|
||||
set(HAVE_DECL_FSEEKO 1)
|
||||
endif()
|
||||
|
||||
# include this header to get the type
|
||||
# Include this header to get the type
|
||||
set(CMAKE_REQUIRED_INCLUDES "${CURL_SOURCE_DIR}/include")
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "curl/system.h")
|
||||
check_type_size("curl_off_t" SIZEOF_CURL_OFF_T)
|
||||
check_type_size("curl_off_t" SIZEOF_CURL_OFF_T)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "curl/curl.h")
|
||||
check_type_size("curl_socket_t" SIZEOF_CURL_SOCKET_T)
|
||||
check_type_size("curl_socket_t" SIZEOF_CURL_SOCKET_T)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "")
|
||||
|
||||
if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
|
||||
# on not-Windows and not-crosscompiling, check for writable argv[]
|
||||
# On non-Windows and not cross-compiling, check for writable argv[]
|
||||
include(CheckCSourceRuns)
|
||||
check_c_source_runs("
|
||||
int main(int argc, char **argv)
|
||||
@ -1485,33 +1478,33 @@ if(ENABLE_WEBSOCKETS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(CURL_TEST
|
||||
foreach(_curl_test IN ITEMS
|
||||
HAVE_GLIBC_STRERROR_R
|
||||
HAVE_POSIX_STRERROR_R
|
||||
)
|
||||
curl_internal_test(${CURL_TEST})
|
||||
curl_internal_test(${_curl_test})
|
||||
endforeach()
|
||||
|
||||
# Check for reentrant
|
||||
foreach(CURL_TEST
|
||||
foreach(_curl_test IN ITEMS
|
||||
HAVE_GETHOSTBYNAME_R_3
|
||||
HAVE_GETHOSTBYNAME_R_5
|
||||
HAVE_GETHOSTBYNAME_R_6)
|
||||
if(NOT ${CURL_TEST})
|
||||
if(${CURL_TEST}_REENTRANT)
|
||||
if(NOT ${_curl_test})
|
||||
if(${_curl_test}_REENTRANT)
|
||||
set(NEED_REENTRANT 1)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NEED_REENTRANT)
|
||||
foreach(CURL_TEST
|
||||
foreach(_curl_test IN ITEMS
|
||||
HAVE_GETHOSTBYNAME_R_3
|
||||
HAVE_GETHOSTBYNAME_R_5
|
||||
HAVE_GETHOSTBYNAME_R_6)
|
||||
set(${CURL_TEST} 0)
|
||||
if(${CURL_TEST}_REENTRANT)
|
||||
set(${CURL_TEST} 1)
|
||||
set(${_curl_test} 0)
|
||||
if(${_curl_test}_REENTRANT)
|
||||
set(${_curl_test} 1)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@ -1600,7 +1593,7 @@ if(CURL_WERROR)
|
||||
if(MSVC_VERSION)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
|
||||
else()
|
||||
# this assumes clang or gcc style options
|
||||
# This assumes clang or gcc style options
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
endif()
|
||||
endif()
|
||||
@ -1617,7 +1610,7 @@ if(CURL_LTO)
|
||||
if(CURL_HAS_LTO)
|
||||
message(STATUS "LTO supported and enabled")
|
||||
else()
|
||||
message(FATAL_ERROR "LTO was requested - but compiler doesn't support it\n${CURL_LTO_ERROR}")
|
||||
message(FATAL_ERROR "LTO was requested - but compiler does not support it\n${CURL_LTO_ERROR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -1626,24 +1619,24 @@ endif()
|
||||
# (= regenerate it).
|
||||
function(transform_makefile_inc INPUT_FILE OUTPUT_FILE)
|
||||
file(STRINGS "${INPUT_FILE}" _makefile_inc_lines)
|
||||
set(MAKEFILE_INC_TEXT "")
|
||||
set(_makefile_inc_text "")
|
||||
foreach(_line IN LISTS _makefile_inc_lines)
|
||||
if(_line MATCHES "### USE SIMPLE LIST ASSIGMENTS ABOVE THIS LINE ###")
|
||||
break()
|
||||
endif()
|
||||
set(MAKEFILE_INC_TEXT "${MAKEFILE_INC_TEXT}${_line}\n")
|
||||
set(_makefile_inc_text "${_makefile_inc_text}${_line}\n")
|
||||
endforeach()
|
||||
|
||||
string(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
string(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" _makefile_inc_text ${_makefile_inc_text})
|
||||
string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" _makefile_inc_text ${_makefile_inc_text})
|
||||
|
||||
string(REGEX REPLACE "\\\\\n" "!π!α!" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "SET(\\1 \\2)" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
string(REPLACE "!π!α!" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||
string(REGEX REPLACE "\\\\\n" "!π!α!" _makefile_inc_text ${_makefile_inc_text})
|
||||
string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "SET(\\1 \\2)" _makefile_inc_text ${_makefile_inc_text})
|
||||
string(REPLACE "!π!α!" "\n" _makefile_inc_text ${_makefile_inc_text})
|
||||
|
||||
string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace $() with ${}
|
||||
string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace @@ with ${}, even if that may not be read by CMake scripts.
|
||||
file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT})
|
||||
string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" _makefile_inc_text ${_makefile_inc_text}) # Replace $() with ${}
|
||||
string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" _makefile_inc_text ${_makefile_inc_text}) # Replace @@ with ${}, even if that may not be read by CMake scripts.
|
||||
file(WRITE ${OUTPUT_FILE} ${_makefile_inc_text})
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${INPUT_FILE}")
|
||||
endfunction()
|
||||
|
||||
@ -1651,9 +1644,9 @@ include(GNUInstallDirs)
|
||||
|
||||
set(CURL_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
|
||||
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||
set(_generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||
set(_project_config "${_generated_dir}/${PROJECT_NAME}Config.cmake")
|
||||
set(_version_config "${_generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||
|
||||
cmake_dependent_option(BUILD_TESTING "Build tests"
|
||||
ON "PERL_FOUND;NOT CURL_DISABLE_TESTS"
|
||||
@ -1684,11 +1677,11 @@ if(ENABLE_DIST_TEST)
|
||||
transform_makefile_inc("Makefile.am" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake)
|
||||
|
||||
file(GLOB_RECURSE curl_cmake_files_found RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
file(GLOB_RECURSE _curl_cmake_files_found RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/*.cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/*.in")
|
||||
|
||||
foreach(_item IN LISTS curl_cmake_files_found)
|
||||
foreach(_item IN LISTS _curl_cmake_files_found)
|
||||
if(NOT _item IN_LIST CMAKE_DIST)
|
||||
message(FATAL_ERROR "Source file missing from the Makefile.am CMAKE_DIST list: ${_item}")
|
||||
endif()
|
||||
@ -1698,16 +1691,16 @@ endif()
|
||||
if(NOT CURL_DISABLE_INSTALL)
|
||||
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/scripts/mk-ca-bundle.pl"
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
# Helper to populate a list (_items) with a label when conditions
|
||||
# (the remaining args) are satisfied
|
||||
macro(_add_if label)
|
||||
# needs to be a macro to allow this indirection
|
||||
# Needs to be a macro to allow this indirection
|
||||
if(${ARGN})
|
||||
set(_items ${_items} "${label}")
|
||||
endif()
|
||||
@ -1766,7 +1759,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
endif()
|
||||
string(REPLACE ";" " " SUPPORT_PROTOCOLS "${_items}")
|
||||
string(TOLOWER "${SUPPORT_PROTOCOLS}" SUPPORT_PROTOCOLS_LOWER)
|
||||
message(STATUS "Protocols: ${SUPPORT_PROTOCOLS_LOWER}")
|
||||
message("Protocols: ${SUPPORT_PROTOCOLS_LOWER}")
|
||||
|
||||
# Clear list and try to detect available features
|
||||
set(_items)
|
||||
@ -1818,7 +1811,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
endif()
|
||||
endif()
|
||||
string(REPLACE ";" " " SUPPORT_FEATURES "${_items}")
|
||||
message(STATUS "Features: ${SUPPORT_FEATURES}")
|
||||
message("Features: ${SUPPORT_FEATURES}")
|
||||
|
||||
# Clear list and collect SSL backends
|
||||
set(_items)
|
||||
@ -1845,7 +1838,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
|
||||
# curl-config needs the following options to be set.
|
||||
set(CC "${CMAKE_C_COMPILER}")
|
||||
# TODO probably put a -D... options here?
|
||||
# TODO: probably put a -D... options here?
|
||||
set(CONFIGURE_OPTIONS "")
|
||||
set(CURLVERSION "${CURL_VERSION}")
|
||||
set(exec_prefix "\${prefix}")
|
||||
@ -1860,7 +1853,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
set(_libcurl_libs_dirs)
|
||||
# To avoid getting unnecessary -L options for known system directories,
|
||||
# _libcurl_libs_dirs is seeded with them.
|
||||
foreach(_libdir ${CMAKE_SYSTEM_PREFIX_PATH})
|
||||
foreach(_libdir IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
|
||||
if(_libdir MATCHES "/$")
|
||||
set(_libdir "${_libdir}lib")
|
||||
else()
|
||||
@ -1877,13 +1870,13 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
|
||||
foreach(_lib IN LISTS CMAKE_C_IMPLICIT_LINK_LIBRARIES CURL_LIBS)
|
||||
if(TARGET "${_lib}")
|
||||
set(_libname "${_lib}")
|
||||
get_target_property(_imported "${_libname}" IMPORTED)
|
||||
if(NOT _imported)
|
||||
# Reading the LOCATION property on non-imported target will error out.
|
||||
# Assume the user won't need this information in the .pc file.
|
||||
# Assume the user will not need this information in the .pc file.
|
||||
continue()
|
||||
endif()
|
||||
get_target_property(_lib "${_libname}" LOCATION)
|
||||
@ -1893,7 +1886,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
endif()
|
||||
endif()
|
||||
if(_lib MATCHES "^-")
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
|
||||
elseif(_lib MATCHES ".*/.*")
|
||||
# This gets a bit more complex, because we want to specify the
|
||||
# directory separately, and only once per directory
|
||||
@ -1903,15 +1896,15 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
list(FIND _libcurl_libs_dirs "${_libdir}" _libdir_index)
|
||||
if(_libdir_index LESS 0)
|
||||
list(APPEND _libcurl_libs_dirs "${_libdir}")
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} -L${_libdir}")
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} -L${_libdir}")
|
||||
endif()
|
||||
string(REGEX REPLACE "^lib" "" _libname "${_libname}")
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_libname}")
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_libname}")
|
||||
else()
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
|
||||
endif()
|
||||
else()
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_lib}")
|
||||
set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@ -1923,29 +1916,29 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
|
||||
# Merge pkg-config private fields into public ones when static-only
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(ENABLE_SHARED "yes")
|
||||
set(LIBCURL_PC_REQUIRES "")
|
||||
set(LIBCURL_NO_SHARED "")
|
||||
set(ENABLE_SHARED "yes")
|
||||
set(LIBCURL_PC_REQUIRES "")
|
||||
set(LIBCURL_NO_SHARED "")
|
||||
set(CPPFLAG_CURL_STATICLIB "")
|
||||
else()
|
||||
set(ENABLE_SHARED "no")
|
||||
set(LIBCURL_PC_REQUIRES "${LIBCURL_PC_REQUIRES_PRIVATE}")
|
||||
set(LIBCURL_NO_SHARED "${LIBCURL_LIBS}")
|
||||
set(ENABLE_SHARED "no")
|
||||
set(LIBCURL_PC_REQUIRES "${LIBCURL_PC_REQUIRES_PRIVATE}")
|
||||
set(LIBCURL_NO_SHARED "${LIBCURL_LIBS}")
|
||||
set(CPPFLAG_CURL_STATICLIB "${LIBCURL_PC_CFLAGS_PRIVATE}")
|
||||
endif()
|
||||
if(BUILD_STATIC_LIBS)
|
||||
set(ENABLE_STATIC "yes")
|
||||
set(ENABLE_STATIC "yes")
|
||||
else()
|
||||
set(ENABLE_STATIC "no")
|
||||
set(ENABLE_STATIC "no")
|
||||
endif()
|
||||
# "a" (Linux) or "lib" (Windows)
|
||||
string(REPLACE "." "" libext "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
# Set this to "yes" to append all libraries on which -lcurl is dependent
|
||||
set(REQUIRE_LIB_DEPS "no")
|
||||
set(REQUIRE_LIB_DEPS "no")
|
||||
# SUPPORT_FEATURES
|
||||
# SUPPORT_PROTOCOLS
|
||||
set(VERSIONNUM "${CURL_VERSION_NUM}")
|
||||
set(VERSIONNUM "${CURL_VERSION_NUM}")
|
||||
|
||||
# Finally generate a "curl-config" matching this config
|
||||
# Use:
|
||||
@ -1954,58 +1947,53 @@ if(NOT CURL_DISABLE_INSTALL)
|
||||
configure_file("${CURL_SOURCE_DIR}/curl-config.in"
|
||||
"${CURL_BINARY_DIR}/curl-config" @ONLY)
|
||||
install(FILES "${CURL_BINARY_DIR}/curl-config"
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
# Finally generate a pkg-config file matching this config
|
||||
configure_file("${CURL_SOURCE_DIR}/libcurl.pc.in"
|
||||
"${CURL_BINARY_DIR}/libcurl.pc" @ONLY)
|
||||
install(FILES "${CURL_BINARY_DIR}/libcurl.pc"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
# install headers
|
||||
# Install headers
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/curl"
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${version_config}"
|
||||
VERSION ${CURL_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
file(READ "${version_config}" generated_version_config)
|
||||
file(WRITE "${version_config}" "
|
||||
if(NOT PACKAGE_FIND_VERSION_RANGE AND PACKAGE_FIND_VERSION_MAJOR STREQUAL \"7\")
|
||||
# Version 8 satisfies version 7... requirements
|
||||
set(PACKAGE_FIND_VERSION_MAJOR 8)
|
||||
set(PACKAGE_FIND_VERSION_COUNT 1)
|
||||
endif()
|
||||
${generated_version_config}"
|
||||
)
|
||||
"${_version_config}"
|
||||
VERSION ${CURL_VERSION}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
file(READ "${_version_config}" _generated_version_config)
|
||||
file(WRITE "${_version_config}" "
|
||||
if(NOT PACKAGE_FIND_VERSION_RANGE AND PACKAGE_FIND_VERSION_MAJOR STREQUAL \"7\")
|
||||
# Version 8 satisfies version 7... requirements
|
||||
set(PACKAGE_FIND_VERSION_MAJOR 8)
|
||||
set(PACKAGE_FIND_VERSION_COUNT 1)
|
||||
endif()
|
||||
${_generated_version_config}")
|
||||
|
||||
# Use:
|
||||
# * TARGETS_EXPORT_NAME
|
||||
# * PROJECT_NAME
|
||||
configure_package_config_file(CMake/curl-config.cmake.in
|
||||
"${project_config}"
|
||||
configure_package_config_file("CMake/curl-config.cmake.in"
|
||||
"${_project_config}"
|
||||
INSTALL_DESTINATION ${CURL_INSTALL_CMAKE_DIR}
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
||||
)
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
|
||||
|
||||
if(CURL_ENABLE_EXPORT_TARGET)
|
||||
install(EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
DESTINATION ${CURL_INSTALL_CMAKE_DIR}
|
||||
)
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
DESTINATION ${CURL_INSTALL_CMAKE_DIR})
|
||||
endif()
|
||||
|
||||
install(FILES ${version_config} ${project_config}
|
||||
DESTINATION ${CURL_INSTALL_CMAKE_DIR}
|
||||
)
|
||||
install(FILES ${_version_config} ${_project_config}
|
||||
DESTINATION ${CURL_INSTALL_CMAKE_DIR})
|
||||
|
||||
# Workaround for MSVS10 to avoid the Dialog Hell
|
||||
# FIXME: This could be removed with future version of CMake.
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
set(MANPAGE "${CURL_BINARY_DIR}/docs/cmdline-opts/curl.1")
|
||||
set(ASCIIPAGE "${CURL_BINARY_DIR}/docs/cmdline-opts/curl.txt")
|
||||
|
||||
# Load DPAGES and OTHERPAGES from shared file
|
||||
# Get 'DPAGES' variable
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
|
||||
|
||||
@ -22,23 +22,23 @@
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# Get 'check_PROGRAMS' variable
|
||||
transform_makefile_inc("Makefile.inc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||
# Get 'check_PROGRAMS' variable
|
||||
|
||||
foreach(example IN LISTS check_PROGRAMS)
|
||||
set(example_target "curl-example-${example}")
|
||||
add_executable(${example_target} "${example}.c")
|
||||
target_include_directories(${example_target} PRIVATE
|
||||
foreach(_example IN LISTS check_PROGRAMS)
|
||||
set(_example_target "curl-example-${_example}")
|
||||
add_executable(${_example_target} "${_example}.c")
|
||||
target_include_directories(${_example_target} PRIVATE
|
||||
"${CURL_SOURCE_DIR}/lib" # for "curl_setup_once.h"
|
||||
"${CURL_BINARY_DIR}/lib" # for "curl_config.h"
|
||||
"${CURL_BINARY_DIR}/include" # for "curl/curl.h"
|
||||
)
|
||||
target_link_libraries(${example_target} ${LIB_SELECTED} ${CURL_LIBS})
|
||||
target_compile_definitions(${example_target} PRIVATE "CURL_NO_OLDIES")
|
||||
target_link_libraries(${_example_target} ${LIB_SELECTED} ${CURL_LIBS})
|
||||
target_compile_definitions(${_example_target} PRIVATE "CURL_NO_OLDIES")
|
||||
if(LIB_SELECTED STREQUAL LIB_STATIC AND WIN32)
|
||||
set_property(TARGET ${example_target} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
|
||||
set_property(TARGET ${_example_target} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
|
||||
endif()
|
||||
set_target_properties(${example_target} PROPERTIES OUTPUT_NAME "${example}" UNITY_BUILD OFF)
|
||||
set_target_properties(${_example_target} PROPERTIES OUTPUT_NAME "${_example}" UNITY_BUILD OFF)
|
||||
endforeach()
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
# Load man_MANS from shared file
|
||||
# Get 'man_MANS' variable
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
|
||||
@ -76,7 +76,7 @@ add_manual_pages(man_MANS)
|
||||
add_custom_target(curl-man ALL DEPENDS ${man_MANS})
|
||||
if(NOT CURL_DISABLE_INSTALL)
|
||||
unset(_src)
|
||||
foreach(_f ${man_MANS})
|
||||
foreach(_f IN LISTS man_MANS)
|
||||
list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_f}")
|
||||
endforeach()
|
||||
install(FILES ${_src} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
# Load man_MANS from shared file
|
||||
# Get 'man_MANS' variable
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
|
||||
@ -30,7 +30,7 @@ add_custom_target(curl-opts-man DEPENDS ${man_MANS})
|
||||
add_dependencies(curl-man curl-opts-man)
|
||||
if(NOT CURL_DISABLE_INSTALL)
|
||||
unset(_src)
|
||||
foreach(_f ${man_MANS})
|
||||
foreach(_f IN LISTS man_MANS)
|
||||
list(APPEND _src "${CMAKE_CURRENT_BINARY_DIR}/${_f}")
|
||||
endforeach()
|
||||
install(FILES ${_src} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
|
||||
|
||||
@ -28,6 +28,7 @@ add_definitions(-DBUILDING_LIBCURL)
|
||||
configure_file(curl_config.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/curl_config.h)
|
||||
|
||||
# Get 'CSOURCES', 'HHEADERS' variables
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||
|
||||
@ -38,19 +39,21 @@ list(APPEND HHEADERS ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h)
|
||||
|
||||
# The rest of the build
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../include)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
if(USE_ARES)
|
||||
include_directories(${CARES_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_library(
|
||||
curlu # special libcurlu library just for unittests
|
||||
curlu # special libcurlu library just for unittests
|
||||
STATIC
|
||||
EXCLUDE_FROM_ALL
|
||||
${HHEADERS} ${CSOURCES}
|
||||
@ -122,7 +125,7 @@ else()
|
||||
set(LIB_SOURCE ${HHEADERS} ${CSOURCES})
|
||||
endif()
|
||||
|
||||
# we want it to be called libcurl on all platforms
|
||||
# We want it to be called libcurl on all platforms
|
||||
if(BUILD_STATIC_LIBS)
|
||||
list(APPEND libcurl_export ${LIB_STATIC})
|
||||
add_library(${LIB_STATIC} STATIC ${LIB_SOURCE})
|
||||
@ -203,22 +206,23 @@ if(BUILD_SHARED_LIBS)
|
||||
# up to v3.x and ELF from v3.x. I cannot imagine someone running CMake
|
||||
# on those ancient systems.
|
||||
CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
set(soversion_default TRUE)
|
||||
set(_soversion_default TRUE)
|
||||
else()
|
||||
set(soversion_default FALSE)
|
||||
set(_soversion_default FALSE)
|
||||
endif()
|
||||
|
||||
option(CURL_LIBCURL_SOVERSION "Enable libcurl SOVERSION" ${soversion_default})
|
||||
option(CURL_LIBCURL_SOVERSION "Enable libcurl SOVERSION" ${_soversion_default})
|
||||
|
||||
if(CURL_LIBCURL_SOVERSION)
|
||||
# Get 'VERSIONCHANGE', 'VERSIONADD', 'VERSIONDEL', 'VERSIONINFO' variables
|
||||
transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake)
|
||||
|
||||
math(EXPR CMAKESONAME "${VERSIONCHANGE} - ${VERSIONDEL}")
|
||||
set(CMAKEVERSION "${CMAKESONAME}.${VERSIONDEL}.${VERSIONADD}")
|
||||
math(EXPR _cmakesoname "${VERSIONCHANGE} - ${VERSIONDEL}")
|
||||
set(_cmakeversion "${_cmakesoname}.${VERSIONDEL}.${VERSIONADD}")
|
||||
|
||||
set_target_properties(${LIB_SHARED} PROPERTIES
|
||||
VERSION "${CMAKEVERSION}" SOVERSION "${CMAKESONAME}")
|
||||
VERSION "${_cmakeversion}" SOVERSION "${_cmakesoname}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -244,7 +248,7 @@ if(CURL_ENABLE_EXPORT_TARGET)
|
||||
endif()
|
||||
|
||||
export(TARGETS ${libcurl_export}
|
||||
FILE ${PROJECT_BINARY_DIR}/libcurl-target.cmake
|
||||
NAMESPACE ${PROJECT_NAME}::
|
||||
FILE ${PROJECT_BINARY_DIR}/libcurl-target.cmake
|
||||
NAMESPACE ${PROJECT_NAME}::
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -48,9 +48,9 @@ else()
|
||||
DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
|
||||
VERBATIM)
|
||||
|
||||
endif()
|
||||
|
||||
# Get 'CURL_CFILES', 'CURLX_CFILES', 'CURL_HFILES', 'CURLTOOL_LIBCURL_CFILES' variables
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||
|
||||
@ -74,8 +74,6 @@ if(WIN32)
|
||||
list(APPEND CURL_CFILES curl.rc)
|
||||
endif()
|
||||
|
||||
# CURL_CFILES, CURLX_CFILES, CURL_HFILES, CURLTOOL_LIBCURL_CFILES
|
||||
# come from Makefile.inc
|
||||
if(BUILD_STATIC_CURL)
|
||||
set(CURLX_CFILES ${CURLTOOL_LIBCURL_CFILES})
|
||||
endif()
|
||||
@ -89,12 +87,12 @@ endif()
|
||||
add_executable(
|
||||
${EXE_NAME}
|
||||
${CURL_CFILES} ${CURLX_CFILES} ${CURL_HFILES}
|
||||
)
|
||||
)
|
||||
|
||||
add_executable(
|
||||
${PROJECT_NAME}::${EXE_NAME}
|
||||
ALIAS ${EXE_NAME}
|
||||
)
|
||||
)
|
||||
|
||||
add_library(
|
||||
curltool # special libcurltool library just for unittests
|
||||
@ -125,21 +123,15 @@ include_directories(
|
||||
${CURL_BINARY_DIR}/include # for "curl/curl.h"
|
||||
# This is needed as tool_hugehelp.c is generated in the binary dir
|
||||
${CURL_SOURCE_DIR}/src # for "tool_hugehelp.h"
|
||||
)
|
||||
)
|
||||
|
||||
# Build curl executable
|
||||
target_link_libraries(${EXE_NAME} ${LIB_SELECTED_FOR_EXE} ${CURL_LIBS})
|
||||
|
||||
################################################################################
|
||||
|
||||
#set_target_properties(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah")
|
||||
#set_target_properties(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah")
|
||||
#set_target_properties(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah")
|
||||
|
||||
#include(ModuleInstall OPTIONAL)
|
||||
|
||||
install(TARGETS ${EXE_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
export(TARGETS ${EXE_NAME}
|
||||
FILE ${PROJECT_BINARY_DIR}/curl-target.cmake
|
||||
NAMESPACE ${PROJECT_NAME}::
|
||||
FILE ${PROJECT_BINARY_DIR}/curl-target.cmake
|
||||
NAMESPACE ${PROJECT_NAME}::
|
||||
)
|
||||
|
||||
@ -33,11 +33,11 @@ function(add_runtests targetname test_flags)
|
||||
# replaced by the contents of the environment variable in runtests.pl.
|
||||
# This is a workaround for CMake's limitation where commands executed by
|
||||
# 'make' or 'ninja' cannot portably reference environment variables.
|
||||
string(REPLACE " " ";" test_flags_list "${test_flags}")
|
||||
string(REPLACE " " ";" _test_flags_list "${test_flags}")
|
||||
add_custom_target(${targetname}
|
||||
COMMAND
|
||||
"${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl"
|
||||
${test_flags_list}
|
||||
${_test_flags_list}
|
||||
"\$TFLAGS"
|
||||
DEPENDS testdeps
|
||||
VERBATIM USES_TERMINAL
|
||||
@ -86,7 +86,7 @@ use vars qw(
|
||||
add_runtests(test-quiet "-a -s")
|
||||
add_runtests(test-am "-a -am")
|
||||
add_runtests(test-full "-a -p -r")
|
||||
# ~flaky means that it'll ignore results of tests using the flaky keyword
|
||||
# ~flaky means that it ignores results of tests using the flaky keyword
|
||||
add_runtests(test-nonflaky "-a -p ~flaky ~timing-dependent")
|
||||
add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r -rm -j2")
|
||||
add_runtests(test-torture "-a -t")
|
||||
|
||||
@ -23,49 +23,49 @@
|
||||
###########################################################################
|
||||
set(TARGET_LABEL_PREFIX "Test ")
|
||||
|
||||
function(setup_test TEST_NAME) # ARGN are the files in the test
|
||||
function(setup_test test_name) # ARGN are the files in the test
|
||||
|
||||
if(LIB_SELECTED STREQUAL LIB_STATIC)
|
||||
# These are part of the libcurl static lib. Do not compile/link them again.
|
||||
list(REMOVE_ITEM ARGN ${WARNLESS} ${MULTIBYTE} ${TIMEDIFF})
|
||||
endif()
|
||||
|
||||
add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN})
|
||||
add_dependencies(testdeps ${TEST_NAME})
|
||||
string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME)
|
||||
add_executable(${test_name} EXCLUDE_FROM_ALL ${ARGN})
|
||||
add_dependencies(testdeps ${test_name})
|
||||
string(TOUPPER ${test_name} UPPER_TEST_NAME)
|
||||
|
||||
include_directories(
|
||||
${CURL_SOURCE_DIR}/lib # for "curl_setup_once.h"
|
||||
${CURL_BINARY_DIR}/lib # for "curl_config.h"
|
||||
${CURL_BINARY_DIR}/include # for "curl/curl.h"
|
||||
${CURL_SOURCE_DIR}/tests/libtest # to be able to build generated tests
|
||||
)
|
||||
)
|
||||
if(USE_ARES)
|
||||
include_directories(${CARES_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TEST_NAME} ${LIB_SELECTED} ${CURL_LIBS})
|
||||
target_link_libraries(${test_name} ${LIB_SELECTED} ${CURL_LIBS})
|
||||
|
||||
set_target_properties(${TEST_NAME}
|
||||
set_target_properties(${test_name}
|
||||
PROPERTIES COMPILE_DEFINITIONS ${UPPER_TEST_NAME})
|
||||
set_target_properties(${TEST_NAME}
|
||||
PROPERTIES PROJECT_LABEL "${TARGET_LABEL_PREFIX}${TEST_NAME}")
|
||||
set_target_properties(${test_name}
|
||||
PROPERTIES PROJECT_LABEL "${TARGET_LABEL_PREFIX}${test_name}")
|
||||
endfunction()
|
||||
|
||||
|
||||
# Get 'noinst_PROGRAMS', '*_SOURCES' variables
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||
|
||||
foreach(TEST_NAME ${noinst_PROGRAMS})
|
||||
if(DEFINED ${TEST_NAME}_SOURCES)
|
||||
setup_test(${TEST_NAME} ${${TEST_NAME}_SOURCES})
|
||||
foreach(_test_name IN LISTS noinst_PROGRAMS)
|
||||
if(DEFINED ${_test_name}_SOURCES)
|
||||
setup_test(${_test_name} ${${_test_name}_SOURCES})
|
||||
else()
|
||||
setup_test(${TEST_NAME} ${nodist_${TEST_NAME}_SOURCES})
|
||||
setup_test(${_test_name} ${nodist_${_test_name}_SOURCES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Allows for hostname override to make tests machine independent.
|
||||
# TODO this cmake build assumes a shared build, detect static linking here!
|
||||
# TODO: this cmake build assumes a shared build, detect static linking here!
|
||||
if(NOT WIN32)
|
||||
add_library(hostname MODULE EXCLUDE_FROM_ALL sethostname.c)
|
||||
add_dependencies(testdeps hostname)
|
||||
|
||||
@ -27,55 +27,39 @@ if(MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4306")
|
||||
endif()
|
||||
|
||||
function(SETUP_EXECUTABLE TEST_NAME) # ARGN are the files in the test
|
||||
add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN})
|
||||
add_dependencies(testdeps ${TEST_NAME})
|
||||
function(setup_executable test_name) # ARGN are the files in the test
|
||||
add_executable(${test_name} EXCLUDE_FROM_ALL ${ARGN})
|
||||
add_dependencies(testdeps ${test_name})
|
||||
|
||||
include_directories(
|
||||
${CURL_SOURCE_DIR}/lib # for "curl_setup_once.h"
|
||||
${CURL_BINARY_DIR}/lib # for "curl_config.h"
|
||||
${CURL_BINARY_DIR}/include # for "curl/curl.h"
|
||||
${CURL_SOURCE_DIR}/src # for "tool_xattr.h"
|
||||
)
|
||||
)
|
||||
if(USE_ARES)
|
||||
include_directories(${CARES_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TEST_NAME} ${CURL_LIBS})
|
||||
target_link_libraries(${test_name} ${CURL_LIBS})
|
||||
|
||||
# Test servers simply are standalone programs that do not use libcurl
|
||||
# library. For convenience and to ease portability of these servers,
|
||||
# some source code files from the libcurl subdirectory are also used
|
||||
# to build the servers. In order to achieve proper linkage of these
|
||||
# files on Win32 targets it is necessary to build the test servers
|
||||
# files on Windows targets it is necessary to build the test servers
|
||||
# with CURL_STATICLIB defined, independently of how libcurl is built.
|
||||
set_target_properties(${TEST_NAME} PROPERTIES
|
||||
set_target_properties(${test_name} PROPERTIES
|
||||
COMPILE_DEFINITIONS CURL_STATICLIB)
|
||||
set_target_properties(${TEST_NAME} PROPERTIES
|
||||
PROJECT_LABEL "${TARGET_LABEL_PREFIX}${TEST_NAME}")
|
||||
set_target_properties(${test_name} PROPERTIES
|
||||
PROJECT_LABEL "${TARGET_LABEL_PREFIX}${test_name}")
|
||||
endfunction()
|
||||
|
||||
|
||||
# Get 'noinst_PROGRAMS', '<target>_SOURCES' variables
|
||||
transform_makefile_inc("Makefile.inc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||
|
||||
foreach(EXECUTABLE_NAME ${noinst_PROGRAMS})
|
||||
setup_executable(${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES})
|
||||
foreach(_executable_name IN LISTS noinst_PROGRAMS)
|
||||
setup_executable(${_executable_name} ${${_executable_name}_SOURCES})
|
||||
endforeach()
|
||||
|
||||
|
||||
# set(useful
|
||||
# getpart.c getpart.h
|
||||
# ${CURL_SOURCE_DIR}/lib/strequal.c
|
||||
# ${CURL_SOURCE_DIR}/lib/base64.c
|
||||
# ${CURL_SOURCE_DIR}/lib/mprintf.c
|
||||
# ${CURL_SOURCE_DIR}/lib/memdebug.c
|
||||
# ${CURL_SOURCE_DIR}/lib/timeval.c
|
||||
# )
|
||||
|
||||
# setup_executable(sws sws.c util.c util.h ${useful})
|
||||
# setup_executable(resolve resolve.c util.c util.h ${useful})
|
||||
# setup_executable(sockfilt sockfilt.c util.c util.h ${useful} ${CURL_SOURCE_DIR}/lib/inet_pton.c)
|
||||
# setup_executable(getpart testpart.c ${useful})
|
||||
# setup_executable(tftpd tftpd.c util.c util.h ${useful} tftp.h)
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# Get 'UNITPROGS', 'UNITFILES' variables
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
||||
|
||||
@ -33,7 +34,7 @@ include_directories(
|
||||
${CURL_BINARY_DIR}/include # for "curl/curl.h"
|
||||
)
|
||||
|
||||
foreach(_testfile ${UNITPROGS})
|
||||
foreach(_testfile IN LISTS UNITPROGS)
|
||||
add_executable(${_testfile} EXCLUDE_FROM_ALL ${_testfile}.c ${UNITFILES})
|
||||
add_dependencies(testdeps ${_testfile})
|
||||
target_link_libraries(${_testfile} curltool curlu)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user