Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/CMakeLists.txt
2659 views
1
#***************************************************************************
2
# _ _ ____ _
3
# Project ___| | | | _ \| |
4
# / __| | | | |_) | |
5
# | (__| |_| | _ <| |___
6
# \___|\___/|_| \_\_____|
7
#
8
# Copyright (C) Daniel Stenberg, <[email protected]>, et al.
9
#
10
# This software is licensed as described in the file COPYING, which
11
# you should have received as part of this distribution. The terms
12
# are also available at https://curl.se/docs/copyright.html.
13
#
14
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
# copies of the Software, and permit persons to whom the Software is
16
# furnished to do so, under the terms of the COPYING file.
17
#
18
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
# KIND, either express or implied.
20
#
21
# SPDX-License-Identifier: curl
22
#
23
###########################################################################
24
# by Tetetest and Sukender (Benoit Neil)
25
26
cmake_minimum_required(VERSION 3.7...3.16 FATAL_ERROR)
27
message(STATUS "Using CMake version ${CMAKE_VERSION}")
28
29
# Collect command-line arguments for buildinfo.txt.
30
# Must reside at the top of the script to work as expected.
31
set(_cmake_args "")
32
if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
33
get_cmake_property(_cache_vars CACHE_VARIABLES)
34
foreach(_cache_var IN ITEMS ${_cache_vars})
35
get_property(_cache_var_helpstring CACHE ${_cache_var} PROPERTY HELPSTRING)
36
if(_cache_var_helpstring STREQUAL "No help, variable specified on the command line.")
37
get_property(_cache_var_type CACHE ${_cache_var} PROPERTY TYPE)
38
get_property(_cache_var_value CACHE ${_cache_var} PROPERTY VALUE)
39
if(_cache_var_type STREQUAL "UNINITIALIZED")
40
set(_cache_var_type)
41
else()
42
set(_cache_var_type ":${_cache_var_type}")
43
endif()
44
string(APPEND _cmake_args " -D${_cache_var}${_cache_var_type}=\"${_cache_var_value}\"")
45
endif()
46
endforeach()
47
endif()
48
49
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
50
include(Utilities)
51
include(Macros)
52
include(CMakeDependentOption)
53
include(CheckCCompilerFlag)
54
55
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/curl/curlver.h" _curl_version_h_contents REGEX "#define LIBCURL_VERSION( |_NUM )")
56
string(REGEX MATCH "#define LIBCURL_VERSION \"[^\"]*" _curl_version ${_curl_version_h_contents})
57
string(REGEX REPLACE "[^\"]+\"" "" _curl_version ${_curl_version})
58
string(REGEX MATCH "#define LIBCURL_VERSION_NUM 0x[0-9a-fA-F]+" _curl_version_num ${_curl_version_h_contents})
59
string(REGEX REPLACE "[^0]+0x" "" _curl_version_num ${_curl_version_num})
60
unset(_curl_version_h_contents)
61
62
message(STATUS "curl version=[${_curl_version}]")
63
64
string(REGEX REPLACE "([0-9]+\.[0-9]+\.[0-9]+).+" "\\1" _curl_version_sem "${_curl_version}")
65
project(CURL
66
VERSION "${_curl_version_sem}"
67
LANGUAGES C)
68
69
# CMake does not recognize some targets accurately. Touch up configuration manually as a workaround.
70
if(WINDOWS_STORE AND MINGW) # mingw UWP build
71
# CMake (as of v3.31.2) gets confused and applies the MSVC rc.exe command-line
72
# template to windres. Reset it to the windres template via 'Modules/Platform/Windows-windres.cmake':
73
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>")
74
elseif(WIN32 AND WINCE AND CMAKE_C_COMPILER_ID STREQUAL "GNU") # mingw32ce build
75
if(NOT MINGW32CE_LIBRARY_DIR)
76
message(FATAL_ERROR "Set MINGW32CE_LIBRARY_DIR variable to the mingw32ce platform library directory.")
77
endif()
78
79
set(MINGW 1)
80
set(MINGW32CE 1)
81
82
# Build implib with libcurl DLL. Copied from CMake's 'Modules/Platform/Windows-GNU.cmake'.
83
set(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS>")
84
string(APPEND CMAKE_C_CREATE_SHARED_LIBRARY " <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB>")
85
string(APPEND CMAKE_C_CREATE_SHARED_LIBRARY " ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
86
87
# Build resources. Copied from CMake's 'Modules/Platform/Windows-windres.cmake'.
88
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>")
89
enable_language(RC)
90
91
# To compile long long integer literals
92
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-std=gnu99")
93
string(APPEND CMAKE_REQUIRED_FLAGS " -std=gnu99")
94
95
set(CMAKE_C_COMPILE_OPTIONS_PIC "") # CMake sets it to '-fPIC', confusing the toolchain and breaking builds. Zap it.
96
97
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
98
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
99
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
100
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
101
set(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
102
set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a")
103
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
104
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
105
elseif(DOS AND CMAKE_C_COMPILER_ID STREQUAL "GNU") # DJGPP
106
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
107
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
108
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
109
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
110
endif()
111
112
# Fill platform level variable when using CMake's built-in Android configuration
113
if(ANDROID AND NOT DEFINED ANDROID_PLATFORM_LEVEL AND NOT CMAKE_SYSTEM_VERSION EQUAL 1)
114
set(ANDROID_PLATFORM_LEVEL "${CMAKE_SYSTEM_VERSION}")
115
endif()
116
117
set(_target_flags "")
118
if(APPLE)
119
string(APPEND _target_flags " APPLE")
120
endif()
121
if(UNIX)
122
string(APPEND _target_flags " UNIX")
123
endif()
124
if(BSD)
125
string(APPEND _target_flags " BSD")
126
endif()
127
if(ANDROID)
128
string(APPEND _target_flags " ANDROID-${ANDROID_PLATFORM_LEVEL}")
129
endif()
130
if(WIN32)
131
string(APPEND _target_flags " WIN32")
132
endif()
133
if(WINCE)
134
string(APPEND _target_flags " WINCE")
135
endif()
136
if(WINDOWS_STORE)
137
string(APPEND _target_flags " UWP")
138
endif()
139
if(CYGWIN)
140
string(APPEND _target_flags " CYGWIN")
141
endif()
142
if(DOS)
143
string(APPEND _target_flags " DOS")
144
endif()
145
if(AMIGA)
146
string(APPEND _target_flags " AMIGA")
147
endif()
148
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
149
string(APPEND _target_flags " GCC")
150
endif()
151
if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
152
string(APPEND _target_flags " APPLE-CLANG")
153
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND MSVC)
154
string(APPEND _target_flags " CLANG-CL")
155
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
156
string(APPEND _target_flags " LLVM-CLANG")
157
endif()
158
if(MINGW)
159
string(APPEND _target_flags " MINGW")
160
endif()
161
if(MSVC)
162
string(APPEND _target_flags " MSVC-${MSVC_VERSION}")
163
endif()
164
if(VCPKG_TOOLCHAIN)
165
string(APPEND _target_flags " VCPKG")
166
endif()
167
if(CMAKE_CROSSCOMPILING)
168
string(APPEND _target_flags " CROSS")
169
endif()
170
message(STATUS "CMake platform flags:${_target_flags}")
171
172
if(CMAKE_CROSSCOMPILING)
173
message(STATUS "Cross-compiling: "
174
"${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_HOST_SYSTEM_PROCESSOR} -> "
175
"${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
176
endif()
177
178
if(CMAKE_C_COMPILER_TARGET)
179
set(CURL_OS "\"${CMAKE_C_COMPILER_TARGET}\"")
180
else()
181
set(CURL_OS "\"${CMAKE_SYSTEM_NAME}\"")
182
endif()
183
184
set(LIB_NAME "libcurl")
185
set(EXE_NAME "curl")
186
187
set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/include")
188
189
if(NOT DEFINED CMAKE_UNITY_BUILD_BATCH_SIZE)
190
set(CMAKE_UNITY_BUILD_BATCH_SIZE 0)
191
endif()
192
193
# Having CMAKE_TRY_COMPILE_TARGET_TYPE set to STATIC_LIBRARY breaks certain
194
# 'check_function_exists()' detections (possibly more), by detecting
195
# non-existing features. This happens by default when using 'ios.toolchain.cmake'.
196
# Work it around by setting this value to `EXECUTABLE`.
197
if(CMAKE_TRY_COMPILE_TARGET_TYPE STREQUAL "STATIC_LIBRARY")
198
message(STATUS "CMAKE_TRY_COMPILE_TARGET_TYPE was found set to STATIC_LIBRARY. "
199
"Overriding with EXECUTABLE for feature detections to work.")
200
set(_cmake_try_compile_target_type_save ${CMAKE_TRY_COMPILE_TARGET_TYPE})
201
set(CMAKE_TRY_COMPILE_TARGET_TYPE "EXECUTABLE")
202
endif()
203
204
option(CURL_WERROR "Turn compiler warnings into errors" OFF)
205
option(PICKY_COMPILER "Enable picky compiler options" ON)
206
option(BUILD_CURL_EXE "Build curl executable" ON)
207
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
208
option(BUILD_STATIC_LIBS "Build static libraries" OFF)
209
option(BUILD_STATIC_CURL "Build curl executable with static libcurl" OFF)
210
option(ENABLE_ARES "Enable c-ares support" OFF)
211
option(CURL_DISABLE_INSTALL "Disable installation targets" OFF)
212
213
if(WIN32)
214
option(ENABLE_UNICODE "Use the Unicode version of the Windows API functions" OFF)
215
if(WINDOWS_STORE OR WINCE)
216
set(ENABLE_UNICODE ON)
217
endif()
218
if(ENABLE_UNICODE)
219
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "UNICODE" "_UNICODE")
220
if(MINGW AND NOT MINGW32CE)
221
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-municode")
222
endif()
223
endif()
224
225
# Apply to all feature checks
226
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
227
if(MSVC)
228
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_CRT_NONSTDC_NO_DEPRECATE") # for strdup() detection
229
endif()
230
231
set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
232
if(CURL_TARGET_WINDOWS_VERSION)
233
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
234
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}") # Apply to all feature checks
235
endif()
236
237
# Detect actual value of _WIN32_WINNT and store as HAVE_WIN32_WINNT
238
curl_internal_test(HAVE_WIN32_WINNT)
239
if(HAVE_WIN32_WINNT)
240
string(REGEX MATCH "_WIN32_WINNT=0x[0-9a-fA-F]+" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
241
string(REGEX REPLACE "_WIN32_WINNT=" "" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
242
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
243
string(TOLOWER "${CURL_TEST_OUTPUT}" HAVE_WIN32_WINNT)
244
message(STATUS "Found _WIN32_WINNT=${HAVE_WIN32_WINNT}")
245
endif()
246
unset(HAVE_WIN32_WINNT CACHE) # Avoid storing in CMake cache
247
248
if(MINGW)
249
# Detect __MINGW64_VERSION_MAJOR, __MINGW64_VERSION_MINOR and store as MINGW64_VERSION
250
curl_internal_test(MINGW64_VERSION)
251
if(MINGW64_VERSION)
252
string(REGEX MATCH "MINGW64_VERSION=[0-9]+\.[0-9]+" CURL_TEST_OUTPUT "${CURL_TEST_OUTPUT}")
253
string(REGEX REPLACE "MINGW64_VERSION=" "" MINGW64_VERSION "${CURL_TEST_OUTPUT}")
254
if(MINGW64_VERSION)
255
message(STATUS "Found MINGW64_VERSION=${MINGW64_VERSION}")
256
if(MINGW64_VERSION VERSION_LESS 3.0)
257
message(FATAL_ERROR "mingw-w64 3.0 or upper is required")
258
endif()
259
endif()
260
endif()
261
unset(MINGW64_VERSION CACHE) # Avoid storing in CMake cache
262
endif()
263
elseif(DOS OR AMIGA)
264
set(BUILD_SHARED_LIBS OFF)
265
set(BUILD_STATIC_LIBS ON)
266
endif()
267
option(CURL_LTO "Enable compiler Link Time Optimizations" OFF)
268
269
if(NOT DOS AND NOT AMIGA)
270
# if c-ares is used, default the threaded resolver to OFF
271
if(ENABLE_ARES)
272
set(_enable_threaded_resolver_default OFF)
273
else()
274
set(_enable_threaded_resolver_default ON)
275
endif()
276
option(ENABLE_THREADED_RESOLVER "Enable threaded DNS lookup" ${_enable_threaded_resolver_default})
277
endif()
278
279
include(PickyWarnings)
280
281
if(CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "GNU")
282
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "_GNU_SOURCE") # Required for accept4(), pipe2(), sendmmsg()
283
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") # Apply to all feature checks
284
endif()
285
286
option(ENABLE_DEBUG "Enable curl debug features (for developing curl itself)" OFF)
287
if(ENABLE_DEBUG)
288
message(WARNING "This curl build is Debug-enabled and insecure, do not use in production.")
289
endif()
290
option(ENABLE_CURLDEBUG "Enable TrackMemory debug feature" ${ENABLE_DEBUG})
291
292
set(CURL_DEBUG_MACROS "")
293
if(ENABLE_DEBUG)
294
list(APPEND CURL_DEBUG_MACROS "DEBUGBUILD")
295
endif()
296
if(ENABLE_CURLDEBUG)
297
list(APPEND CURL_DEBUG_MACROS "CURLDEBUG")
298
endif()
299
300
option(CURL_CLANG_TIDY "Run the build through clang-tidy" OFF)
301
if(CURL_CLANG_TIDY)
302
set(CMAKE_UNITY_BUILD OFF) # clang-tidy is not looking into #included sources, thus not compatible with unity builds.
303
set(_tidy_checks "")
304
list(APPEND _tidy_checks "-clang-analyzer-security.insecureAPI.bzero") # for FD_ZERO() (seen on macOS)
305
list(APPEND _tidy_checks "-clang-analyzer-security.insecureAPI.strcpy")
306
list(APPEND _tidy_checks "-clang-analyzer-optin.performance.Padding")
307
list(APPEND _tidy_checks "-clang-analyzer-security.ArrayBound") # false positives with clang-tidy v21.1.0
308
list(APPEND _tidy_checks "-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling")
309
string(REPLACE ";" "," _tidy_checks "${_tidy_checks}")
310
find_program(CLANG_TIDY NAMES "clang-tidy" REQUIRED)
311
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY}" "-checks=${_tidy_checks}" "-quiet")
312
unset(_tidy_checks)
313
if(CURL_WERROR)
314
list(APPEND CMAKE_C_CLANG_TIDY "--warnings-as-errors=*")
315
endif()
316
if(CURL_CLANG_TIDYFLAGS)
317
list(APPEND CMAKE_C_CLANG_TIDY ${CURL_CLANG_TIDYFLAGS})
318
endif()
319
endif()
320
321
option(CURL_CODE_COVERAGE "Enable code coverage build options" OFF)
322
if(CURL_CODE_COVERAGE)
323
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
324
set(CURL_COVERAGE_MACROS "NDEBUG")
325
set(CURL_COVERAGE_CFLAGS "-O0" "-g" "-fprofile-arcs")
326
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.1)
327
list(APPEND CURL_COVERAGE_CFLAGS "--coverage")
328
else()
329
list(APPEND CURL_COVERAGE_CFLAGS "-ftest-coverage")
330
endif()
331
set(CURL_COVERAGE_LIBS "gcov")
332
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
333
set(CURL_COVERAGE_MACROS "NDEBUG")
334
set(CURL_COVERAGE_CFLAGS "-O0" "-g" "-fprofile-instr-generate" "-fcoverage-mapping")
335
set(CURL_COVERAGE_LDFLAGS "-fprofile-instr-generate" "-fcoverage-mapping")
336
else()
337
set(CURL_CODE_COVERAGE OFF)
338
endif()
339
endif()
340
341
# For debug libs and exes, add "-d" postfix
342
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
343
set(CMAKE_DEBUG_POSTFIX "-d")
344
endif()
345
346
set(LIB_STATIC "libcurl_static")
347
set(LIB_SHARED "libcurl_shared")
348
349
if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
350
set(BUILD_STATIC_LIBS ON)
351
endif()
352
if(NOT BUILD_STATIC_CURL AND NOT BUILD_SHARED_LIBS)
353
set(BUILD_STATIC_CURL ON)
354
elseif(BUILD_STATIC_CURL AND NOT BUILD_STATIC_LIBS)
355
set(BUILD_STATIC_CURL OFF)
356
endif()
357
358
# Lib flavour selected for curl tool
359
if(BUILD_STATIC_CURL)
360
set(LIB_SELECTED_FOR_EXE ${LIB_STATIC})
361
else()
362
set(LIB_SELECTED_FOR_EXE ${LIB_SHARED})
363
endif()
364
365
# Lib flavour selected for example and test programs.
366
if(BUILD_SHARED_LIBS)
367
set(LIB_SELECTED ${LIB_SHARED})
368
else()
369
set(LIB_SELECTED ${LIB_STATIC})
370
endif()
371
372
if(WIN32)
373
option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF)
374
if(CURL_STATIC_CRT AND MSVC)
375
if(MSVC_VERSION GREATER_EQUAL 1900 OR BUILD_STATIC_CURL OR NOT BUILD_CURL_EXE)
376
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
377
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "$<$<CONFIG:Release>:-MT>")
378
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "$<$<CONFIG:Debug>:-MTd>")
379
else()
380
message(WARNING "Static CRT requires UCRT, static libcurl or no curl executable.")
381
endif()
382
endif()
383
endif()
384
385
# Override to force-disable or force-enable the use of pkg-config.
386
if((UNIX AND NOT ANDROID AND (NOT APPLE OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")) OR
387
VCPKG_TOOLCHAIN OR
388
(MINGW AND NOT CMAKE_CROSSCOMPILING))
389
set(_curl_use_pkgconfig_default ON)
390
else()
391
set(_curl_use_pkgconfig_default OFF)
392
endif()
393
option(CURL_USE_PKGCONFIG "Enable pkg-config to detect dependencies" ${_curl_use_pkgconfig_default})
394
395
# Initialize variables collecting dependency libs, paths, pkg-config names.
396
set(CURL_NETWORK_AND_TIME_LIBS "")
397
set(CURL_LIBS "")
398
set(CURL_LIBDIRS "")
399
set(LIBCURL_PC_REQUIRES_PRIVATE "")
400
401
if(ENABLE_ARES)
402
set(USE_ARES 1)
403
find_package(Cares REQUIRED)
404
list(APPEND CURL_LIBS ${CARES_LIBRARIES})
405
list(APPEND CURL_LIBDIRS ${CARES_LIBRARY_DIRS})
406
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${CARES_PC_REQUIRES})
407
include_directories(SYSTEM ${CARES_INCLUDE_DIRS})
408
link_directories(${CARES_LIBRARY_DIRS})
409
if(CARES_CFLAGS)
410
string(APPEND CMAKE_C_FLAGS " ${CARES_CFLAGS}")
411
endif()
412
endif()
413
414
include(CurlSymbolHiding)
415
416
option(CURL_ENABLE_EXPORT_TARGET "Enable CMake export target" ON)
417
mark_as_advanced(CURL_ENABLE_EXPORT_TARGET)
418
419
option(CURL_DISABLE_ALTSVC "Disable alt-svc support" OFF)
420
mark_as_advanced(CURL_DISABLE_ALTSVC)
421
option(CURL_DISABLE_SRP "Disable TLS-SRP support" OFF)
422
mark_as_advanced(CURL_DISABLE_SRP)
423
option(CURL_DISABLE_COOKIES "Disable cookies support" OFF)
424
mark_as_advanced(CURL_DISABLE_COOKIES)
425
option(CURL_DISABLE_BASIC_AUTH "Disable Basic authentication" OFF)
426
mark_as_advanced(CURL_DISABLE_BASIC_AUTH)
427
option(CURL_DISABLE_BEARER_AUTH "Disable Bearer authentication" OFF)
428
mark_as_advanced(CURL_DISABLE_BEARER_AUTH)
429
option(CURL_DISABLE_DIGEST_AUTH "Disable Digest authentication" OFF)
430
mark_as_advanced(CURL_DISABLE_DIGEST_AUTH)
431
option(CURL_DISABLE_KERBEROS_AUTH "Disable Kerberos authentication" OFF)
432
mark_as_advanced(CURL_DISABLE_KERBEROS_AUTH)
433
option(CURL_DISABLE_NEGOTIATE_AUTH "Disable negotiate authentication" OFF)
434
mark_as_advanced(CURL_DISABLE_NEGOTIATE_AUTH)
435
option(CURL_DISABLE_AWS "Disable aws-sigv4" OFF)
436
mark_as_advanced(CURL_DISABLE_AWS)
437
option(CURL_DISABLE_DICT "Disable DICT" OFF)
438
mark_as_advanced(CURL_DISABLE_DICT)
439
option(CURL_DISABLE_DOH "Disable DNS-over-HTTPS" OFF)
440
mark_as_advanced(CURL_DISABLE_DOH)
441
option(CURL_DISABLE_FILE "Disable FILE" OFF)
442
mark_as_advanced(CURL_DISABLE_FILE)
443
option(CURL_DISABLE_FTP "Disable FTP" OFF)
444
mark_as_advanced(CURL_DISABLE_FTP)
445
option(CURL_DISABLE_GETOPTIONS "Disable curl_easy_options API for existing options to curl_easy_setopt" OFF)
446
mark_as_advanced(CURL_DISABLE_GETOPTIONS)
447
option(CURL_DISABLE_GOPHER "Disable Gopher" OFF)
448
mark_as_advanced(CURL_DISABLE_GOPHER)
449
option(CURL_DISABLE_HEADERS_API "Disable headers-api support" OFF)
450
mark_as_advanced(CURL_DISABLE_HEADERS_API)
451
option(CURL_DISABLE_HSTS "Disable HSTS support" OFF)
452
mark_as_advanced(CURL_DISABLE_HSTS)
453
option(CURL_DISABLE_HTTP "Disable HTTP" OFF)
454
mark_as_advanced(CURL_DISABLE_HTTP)
455
option(CURL_DISABLE_HTTP_AUTH "Disable all HTTP authentication methods" OFF)
456
mark_as_advanced(CURL_DISABLE_HTTP_AUTH)
457
option(CURL_DISABLE_IMAP "Disable IMAP" OFF)
458
mark_as_advanced(CURL_DISABLE_IMAP)
459
option(CURL_DISABLE_LDAP "Disable LDAP" OFF)
460
mark_as_advanced(CURL_DISABLE_LDAP)
461
option(CURL_DISABLE_LDAPS "Disable LDAPS" ${CURL_DISABLE_LDAP})
462
mark_as_advanced(CURL_DISABLE_LDAPS)
463
option(CURL_DISABLE_LIBCURL_OPTION "Disable --libcurl option from the curl tool" OFF)
464
mark_as_advanced(CURL_DISABLE_LIBCURL_OPTION)
465
option(CURL_DISABLE_MIME "Disable MIME support" OFF)
466
mark_as_advanced(CURL_DISABLE_MIME)
467
cmake_dependent_option(CURL_DISABLE_FORM_API "Disable form-api"
468
OFF "NOT CURL_DISABLE_MIME"
469
ON)
470
mark_as_advanced(CURL_DISABLE_FORM_API)
471
option(CURL_DISABLE_MQTT "Disable MQTT" OFF)
472
mark_as_advanced(CURL_DISABLE_MQTT)
473
option(CURL_DISABLE_BINDLOCAL "Disable local binding support" OFF)
474
mark_as_advanced(CURL_DISABLE_BINDLOCAL)
475
option(CURL_DISABLE_NETRC "Disable netrc parser" OFF)
476
mark_as_advanced(CURL_DISABLE_NETRC)
477
option(CURL_DISABLE_NTLM "Disable NTLM support" OFF)
478
mark_as_advanced(CURL_DISABLE_NTLM)
479
option(CURL_DISABLE_PARSEDATE "Disable date parsing" OFF)
480
mark_as_advanced(CURL_DISABLE_PARSEDATE)
481
option(CURL_DISABLE_POP3 "Disable POP3" OFF)
482
mark_as_advanced(CURL_DISABLE_POP3)
483
option(CURL_DISABLE_PROGRESS_METER "Disable built-in progress meter" OFF)
484
mark_as_advanced(CURL_DISABLE_PROGRESS_METER)
485
option(CURL_DISABLE_PROXY "Disable proxy support" OFF)
486
mark_as_advanced(CURL_DISABLE_PROXY)
487
option(CURL_DISABLE_IPFS "Disable IPFS" OFF)
488
mark_as_advanced(CURL_DISABLE_IPFS)
489
option(CURL_DISABLE_RTSP "Disable RTSP" OFF)
490
mark_as_advanced(CURL_DISABLE_RTSP)
491
option(CURL_DISABLE_SHA512_256 "Disable SHA-512/256 hash algorithm" OFF)
492
mark_as_advanced(CURL_DISABLE_SHA512_256)
493
option(CURL_DISABLE_SHUFFLE_DNS "Disable shuffle DNS feature" OFF)
494
mark_as_advanced(CURL_DISABLE_SHUFFLE_DNS)
495
option(CURL_DISABLE_SMB "Disable SMB" OFF)
496
mark_as_advanced(CURL_DISABLE_SMB)
497
option(CURL_DISABLE_SMTP "Disable SMTP" OFF)
498
mark_as_advanced(CURL_DISABLE_SMTP)
499
option(CURL_DISABLE_SOCKETPAIR "Disable use of socketpair for curl_multi_poll" OFF)
500
mark_as_advanced(CURL_DISABLE_SOCKETPAIR)
501
option(CURL_DISABLE_WEBSOCKETS "Disable WebSocket" OFF)
502
mark_as_advanced(CURL_DISABLE_WEBSOCKETS)
503
option(CURL_DISABLE_TELNET "Disable Telnet" OFF)
504
mark_as_advanced(CURL_DISABLE_TELNET)
505
option(CURL_DISABLE_TFTP "Disable TFTP" OFF)
506
mark_as_advanced(CURL_DISABLE_TFTP)
507
option(CURL_DISABLE_VERBOSE_STRINGS "Disable verbose strings" OFF)
508
mark_as_advanced(CURL_DISABLE_VERBOSE_STRINGS)
509
510
if(CURL_DISABLE_HTTP)
511
set(CURL_DISABLE_ALTSVC ON)
512
set(CURL_DISABLE_HSTS ON)
513
set(CURL_DISABLE_IPFS ON)
514
set(CURL_DISABLE_RTSP ON)
515
set(CURL_DISABLE_WEBSOCKETS ON)
516
endif()
517
518
# Corresponds to HTTP_ONLY in lib/curl_setup.h
519
option(HTTP_ONLY "Disable all protocols except HTTP (This overrides all CURL_DISABLE_* options)" OFF)
520
mark_as_advanced(HTTP_ONLY)
521
522
if(HTTP_ONLY)
523
set(CURL_DISABLE_DICT ON)
524
set(CURL_DISABLE_FILE ON)
525
set(CURL_DISABLE_FTP ON)
526
set(CURL_DISABLE_GOPHER ON)
527
set(CURL_DISABLE_IMAP ON)
528
set(CURL_DISABLE_IPFS ON)
529
set(CURL_DISABLE_LDAP ON)
530
set(CURL_DISABLE_LDAPS ON)
531
set(CURL_DISABLE_MQTT ON)
532
set(CURL_DISABLE_POP3 ON)
533
set(CURL_DISABLE_RTSP ON)
534
set(CURL_DISABLE_SMB ON)
535
set(CURL_DISABLE_SMTP ON)
536
set(CURL_DISABLE_TELNET ON)
537
set(CURL_DISABLE_TFTP ON)
538
endif()
539
540
if(WINDOWS_STORE OR WINCE)
541
set(CURL_DISABLE_TELNET ON) # telnet code needs fixing to compile for UWP.
542
endif()
543
544
find_package(Perl)
545
546
if(PERL_EXECUTABLE)
547
add_custom_target(curl-ca-bundle
548
COMMENT "Generating a fresh ca-bundle.crt" VERBATIM USES_TERMINAL
549
COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/mk-ca-bundle.pl" -b -l -u "lib/ca-bundle.crt"
550
DEPENDS "${PROJECT_SOURCE_DIR}/scripts/mk-ca-bundle.pl"
551
)
552
add_custom_target(curl-ca-firefox
553
COMMENT "Generating a fresh ca-bundle.crt" VERBATIM USES_TERMINAL
554
COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/firefox-db2pem.sh" "lib/ca-bundle.crt"
555
DEPENDS "${PROJECT_SOURCE_DIR}/scripts/firefox-db2pem.sh"
556
)
557
endif()
558
559
option(BUILD_LIBCURL_DOCS "Build libcurl man pages" ON)
560
option(BUILD_MISC_DOCS "Build misc man pages (e.g. curl-config and mk-ca-bundle)" ON)
561
option(ENABLE_CURL_MANUAL "Build the man page for curl and enable its -M/--manual option" ON)
562
563
if((ENABLE_CURL_MANUAL OR BUILD_LIBCURL_DOCS) AND NOT PERL_FOUND)
564
message(WARNING "Perl not found. Will not build manuals.")
565
endif()
566
567
# If we are on AIX, do the _ALL_SOURCE magic
568
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
569
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "_ALL_SOURCE")
570
endif()
571
572
# If we are on Haiku, make sure that the network library is brought in.
573
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
574
list(APPEND CURL_NETWORK_AND_TIME_LIBS "network")
575
elseif(AMIGA)
576
list(APPEND CURL_NETWORK_AND_TIME_LIBS "net" "m" "atomic")
577
list(APPEND CMAKE_REQUIRED_LIBRARIES "net" "m" "atomic")
578
endif()
579
580
# Include all the necessary files for macros
581
include(CMakePushCheckState)
582
include(CheckFunctionExists)
583
include(CheckIncludeFile)
584
include(CheckIncludeFiles)
585
include(CheckLibraryExists)
586
include(CheckSymbolExists)
587
include(CheckTypeSize)
588
include(CheckCSourceCompiles)
589
590
option(_CURL_PREFILL "Fast-track known feature detection results (Windows, some Apple)" "${WIN32}")
591
if(_CURL_PREFILL)
592
if(WIN32)
593
include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/win32-cache.cmake")
594
elseif(UNIX)
595
include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/unix-cache.cmake")
596
message(STATUS "Pre-filling feature detection results for UNIX")
597
endif()
598
elseif(WIN32)
599
message(STATUS "Pre-filling feature detection results disabled.")
600
elseif(APPLE)
601
set(HAVE_EVENTFD 0)
602
set(HAVE_GETPASS_R 0)
603
set(HAVE_WRITABLE_ARGV 1)
604
set(HAVE_SENDMMSG 0)
605
endif()
606
607
if(AMIGA)
608
set(HAVE_GETADDRINFO 0) # Breaks the build when detected and used.
609
endif()
610
if(DOS OR AMIGA)
611
set(HAVE_TIME_T_UNSIGNED 1)
612
endif()
613
614
if(ENABLE_THREADED_RESOLVER)
615
if(WIN32)
616
set(USE_THREADS_WIN32 ON)
617
else()
618
find_package(Threads REQUIRED)
619
set(USE_THREADS_POSIX ${CMAKE_USE_PTHREADS_INIT})
620
set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT})
621
list(APPEND CURL_NETWORK_AND_TIME_LIBS ${CMAKE_THREAD_LIBS_INIT})
622
endif()
623
endif()
624
625
# Check for all needed libraries
626
if(WIN32)
627
if(WINCE)
628
set(_win32_winsock "ws2")
629
else()
630
set(_win32_winsock "ws2_32")
631
endif()
632
set(_win32_crypt32 "crypt32")
633
set(_win32_secur32 "secur32")
634
635
if(MINGW32CE) # FIXME upstream: must specify the full path to avoid CMake converting "ws2" to "ws2.lib"
636
set(_win32_winsock "${MINGW32CE_LIBRARY_DIR}/lib${_win32_winsock}.a")
637
set(_win32_crypt32 "${MINGW32CE_LIBRARY_DIR}/lib${_win32_crypt32}.a")
638
set(_win32_secur32 "${MINGW32CE_LIBRARY_DIR}/lib${_win32_secur32}.a")
639
endif()
640
elseif(DOS)
641
if(WATT_ROOT)
642
set(USE_WATT32 ON)
643
# FIXME upstream: must specify the full path to avoid CMake converting "watt" to "watt.lib"
644
list(APPEND CURL_NETWORK_AND_TIME_LIBS "${WATT_ROOT}/lib/libwatt.a")
645
include_directories(SYSTEM "${WATT_ROOT}/inc")
646
list(APPEND CMAKE_REQUIRED_INCLUDES "${WATT_ROOT}/inc")
647
else()
648
message(FATAL_ERROR "Set WATT_ROOT variable to the absolute path to the root installation of Watt-32.")
649
endif()
650
elseif(AMIGA)
651
if(AMISSL_INCLUDE_DIR AND AMISSL_STUBS_LIBRARY AND AMISSL_AUTO_LIBRARY)
652
set(USE_AMISSL ON)
653
list(APPEND CMAKE_REQUIRED_INCLUDES "${AMISSL_INCLUDE_DIR}")
654
list(APPEND CMAKE_REQUIRED_LIBRARIES "${AMISSL_STUBS_LIBRARY}" "${AMISSL_AUTO_LIBRARY}")
655
set(OPENSSL_INCLUDE_DIR "${AMISSL_INCLUDE_DIR}")
656
set(OPENSSL_SSL_LIBRARY "${AMISSL_STUBS_LIBRARY}")
657
set(OPENSSL_CRYPTO_LIBRARY "${AMISSL_AUTO_LIBRARY}")
658
set(CURL_USE_OPENSSL ON)
659
set(CURL_CA_FALLBACK ON CACHE BOOL "")
660
endif()
661
elseif(NOT APPLE)
662
check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
663
if(HAVE_LIBSOCKET)
664
set(CURL_NETWORK_AND_TIME_LIBS "socket" ${CURL_NETWORK_AND_TIME_LIBS})
665
endif()
666
endif()
667
668
option(ENABLE_IPV6 "Enable IPv6 support" ON)
669
mark_as_advanced(ENABLE_IPV6)
670
if(ENABLE_IPV6)
671
include(CheckStructHasMember)
672
if(WIN32)
673
check_struct_has_member("struct sockaddr_in6" "sin6_scope_id" "winsock2.h;ws2tcpip.h" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
674
else()
675
check_struct_has_member("struct sockaddr_in6" "sin6_scope_id" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
676
check_struct_has_member("struct sockaddr_in6" "sin6_addr" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_ADDR)
677
if(NOT HAVE_SOCKADDR_IN6_SIN6_ADDR)
678
if(NOT DOS AND NOT AMIGA)
679
message(WARNING "struct sockaddr_in6 not available, disabling IPv6 support")
680
endif()
681
set(ENABLE_IPV6 OFF CACHE BOOL "Enable IPv6 support" FORCE) # Force the feature off as we use this name as guard macro
682
endif()
683
684
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_ARES)
685
set(_use_core_foundation_and_core_services ON)
686
687
find_library(SYSTEMCONFIGURATION_FRAMEWORK NAMES "SystemConfiguration")
688
mark_as_advanced(SYSTEMCONFIGURATION_FRAMEWORK)
689
if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
690
message(FATAL_ERROR "SystemConfiguration framework not found")
691
endif()
692
list(APPEND CURL_LIBS "-framework SystemConfiguration")
693
endif()
694
endif()
695
endif()
696
if(ENABLE_IPV6 AND NOT WINCE)
697
set(USE_IPV6 ON)
698
endif()
699
700
# Check SSL libraries
701
option(CURL_ENABLE_SSL "Enable SSL support" ON)
702
703
if(CURL_DEFAULT_SSL_BACKEND)
704
set(_valid_default_ssl_backend FALSE)
705
endif()
706
707
if(WIN32)
708
cmake_dependent_option(CURL_USE_SCHANNEL "Enable Windows native SSL/TLS (Schannel)" OFF CURL_ENABLE_SSL OFF)
709
option(CURL_WINDOWS_SSPI "Enable SSPI on Windows" ${CURL_USE_SCHANNEL})
710
else()
711
set(CURL_USE_SCHANNEL OFF)
712
set(CURL_WINDOWS_SSPI OFF)
713
endif()
714
cmake_dependent_option(CURL_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
715
cmake_dependent_option(CURL_USE_WOLFSSL "Enable wolfSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
716
cmake_dependent_option(CURL_USE_GNUTLS "Enable GnuTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
717
cmake_dependent_option(CURL_USE_RUSTLS "Enable Rustls for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
718
719
if(WIN32 OR
720
CURL_USE_SCHANNEL OR
721
CURL_USE_MBEDTLS OR
722
CURL_USE_WOLFSSL OR
723
CURL_USE_GNUTLS OR
724
CURL_USE_RUSTLS)
725
set(_openssl_default OFF)
726
else()
727
set(_openssl_default ON)
728
endif()
729
cmake_dependent_option(CURL_USE_OPENSSL "Enable OpenSSL for SSL/TLS" ${_openssl_default} CURL_ENABLE_SSL OFF)
730
option(USE_OPENSSL_QUIC "Use OpenSSL and nghttp3 libraries for HTTP/3 support" OFF)
731
if(USE_OPENSSL_QUIC AND NOT CURL_USE_OPENSSL)
732
message(WARNING "OpenSSL QUIC has been requested, but without enabling OpenSSL. Will not enable QUIC.")
733
set(USE_OPENSSL_QUIC OFF)
734
endif()
735
option(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG "Disable automatic loading of OpenSSL configuration" OFF)
736
737
curl_count_true(_enabled_ssl_options_count
738
CURL_USE_SCHANNEL
739
CURL_USE_OPENSSL
740
CURL_USE_MBEDTLS
741
CURL_USE_WOLFSSL
742
CURL_USE_GNUTLS
743
CURL_USE_RUSTLS
744
)
745
if(_enabled_ssl_options_count GREATER 1)
746
set(CURL_WITH_MULTI_SSL ON)
747
elseif(_enabled_ssl_options_count EQUAL 0)
748
set(CURL_DISABLE_HSTS ON)
749
endif()
750
751
if(CURL_USE_SCHANNEL)
752
if(WINDOWS_STORE)
753
message(FATAL_ERROR "UWP does not support Schannel.")
754
endif()
755
set(_ssl_enabled ON)
756
set(USE_SCHANNEL ON) # Windows native SSL/TLS support
757
set(USE_WINDOWS_SSPI ON) # CURL_USE_SCHANNEL requires CURL_WINDOWS_SSPI
758
759
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "schannel")
760
set(_valid_default_ssl_backend TRUE)
761
endif()
762
endif()
763
if(CURL_WINDOWS_SSPI AND NOT WINDOWS_STORE)
764
set(USE_WINDOWS_SSPI ON)
765
endif()
766
767
if(APPLE)
768
option(USE_APPLE_SECTRUST "Use Apple OS-native certificate verification" OFF)
769
if(USE_APPLE_SECTRUST)
770
if(NOT CURL_USE_OPENSSL AND NOT CURL_USE_GNUTLS)
771
message(FATAL_ERROR "Apple SecTrust is only supported with Openssl/GnuTLS")
772
endif()
773
find_library(COREFOUNDATION_FRAMEWORK NAMES "Security")
774
mark_as_advanced(COREFOUNDATION_FRAMEWORK)
775
if(NOT COREFOUNDATION_FRAMEWORK)
776
message(FATAL_ERROR "Security framework not found")
777
endif()
778
list(APPEND CURL_LIBS "-framework Security")
779
780
set(_use_core_foundation_and_core_services ON)
781
message(STATUS "Apple OS-native certificate verification enabled")
782
endif()
783
else()
784
set(USE_APPLE_SECTRUST OFF)
785
endif()
786
787
if(_use_core_foundation_and_core_services)
788
find_library(COREFOUNDATION_FRAMEWORK NAMES "CoreFoundation")
789
mark_as_advanced(COREFOUNDATION_FRAMEWORK)
790
if(NOT COREFOUNDATION_FRAMEWORK)
791
message(FATAL_ERROR "CoreFoundation framework not found")
792
endif()
793
list(APPEND CURL_LIBS "-framework CoreFoundation")
794
795
find_library(CORESERVICES_FRAMEWORK NAMES "CoreServices")
796
mark_as_advanced(CORESERVICES_FRAMEWORK)
797
if(NOT CORESERVICES_FRAMEWORK)
798
message(FATAL_ERROR "CoreServices framework not found")
799
endif()
800
list(APPEND CURL_LIBS "-framework CoreServices")
801
endif()
802
803
if(CURL_USE_OPENSSL)
804
find_package(OpenSSL REQUIRED)
805
set(_ssl_enabled ON)
806
set(USE_OPENSSL ON)
807
808
# Depend on OpenSSL via imported targets. This allows our dependents to
809
# get our dependencies transitively.
810
list(APPEND CURL_LIBS OpenSSL::SSL OpenSSL::Crypto)
811
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "openssl")
812
813
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "openssl")
814
set(_valid_default_ssl_backend TRUE)
815
endif()
816
set(_curl_ca_bundle_supported TRUE)
817
818
cmake_push_check_state()
819
list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
820
if(NOT DEFINED HAVE_BORINGSSL)
821
check_symbol_exists("OPENSSL_IS_BORINGSSL" "openssl/base.h" HAVE_BORINGSSL)
822
endif()
823
if(NOT DEFINED HAVE_AWSLC)
824
check_symbol_exists("OPENSSL_IS_AWSLC" "openssl/base.h" HAVE_AWSLC)
825
endif()
826
if(NOT DEFINED HAVE_LIBRESSL)
827
check_symbol_exists("LIBRESSL_VERSION_NUMBER" "openssl/opensslv.h" HAVE_LIBRESSL)
828
endif()
829
cmake_pop_check_state()
830
831
if(HAVE_BORINGSSL OR HAVE_AWSLC)
832
if(OPENSSL_USE_STATIC_LIBS AND CMAKE_C_COMPILER_ID MATCHES "Clang")
833
list(APPEND CURL_LIBS "stdc++")
834
list(APPEND CMAKE_REQUIRED_LIBRARIES "stdc++")
835
endif()
836
endif()
837
838
if(HAVE_BORINGSSL)
839
set(_openssl "BoringSSL")
840
elseif(HAVE_AWSLC)
841
set(_openssl "AWS-LC")
842
elseif(HAVE_LIBRESSL)
843
set(_openssl "LibreSSL")
844
elseif(USE_AMISSL)
845
set(_openssl "AmiSSL")
846
else()
847
set(_openssl "OpenSSL")
848
endif()
849
endif()
850
851
if(CURL_USE_MBEDTLS)
852
find_package(MbedTLS REQUIRED)
853
if(MBEDTLS_VERSION VERSION_LESS 3.2.0)
854
message(FATAL_ERROR "mbedTLS v3.2.0 or newer is required.")
855
endif()
856
set(_ssl_enabled ON)
857
set(USE_MBEDTLS ON)
858
list(APPEND CURL_LIBS ${MBEDTLS_LIBRARIES})
859
list(APPEND CURL_LIBDIRS ${MBEDTLS_LIBRARY_DIRS})
860
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${MBEDTLS_PC_REQUIRES})
861
include_directories(SYSTEM ${MBEDTLS_INCLUDE_DIRS})
862
link_directories(${MBEDTLS_LIBRARY_DIRS})
863
if(MBEDTLS_CFLAGS)
864
string(APPEND CMAKE_C_FLAGS " ${MBEDTLS_CFLAGS}")
865
endif()
866
867
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "mbedtls")
868
set(_valid_default_ssl_backend TRUE)
869
endif()
870
set(_curl_ca_bundle_supported TRUE)
871
872
if(MBEDTLS_VERSION VERSION_GREATER_EQUAL 4.0.0)
873
set(HAVE_MBEDTLS_DES_CRYPT_ECB 0) # pre-fill detection result
874
endif()
875
if(NOT DEFINED HAVE_MBEDTLS_DES_CRYPT_ECB)
876
cmake_push_check_state()
877
list(APPEND CMAKE_REQUIRED_INCLUDES "${MBEDTLS_INCLUDE_DIRS}")
878
list(APPEND CMAKE_REQUIRED_LIBRARIES "${MBEDTLS_LIBRARIES}")
879
curl_required_libpaths("${MBEDTLS_LIBRARY_DIRS}")
880
check_function_exists("mbedtls_des_crypt_ecb" HAVE_MBEDTLS_DES_CRYPT_ECB) # in mbedTLS <4
881
cmake_pop_check_state()
882
endif()
883
endif()
884
885
if(CURL_USE_WOLFSSL)
886
find_package(WolfSSL REQUIRED)
887
set(_ssl_enabled ON)
888
set(USE_WOLFSSL ON)
889
list(APPEND CURL_LIBS ${WOLFSSL_LIBRARIES})
890
list(APPEND CURL_LIBDIRS ${WOLFSSL_LIBRARY_DIRS})
891
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${WOLFSSL_PC_REQUIRES})
892
include_directories(SYSTEM ${WOLFSSL_INCLUDE_DIRS})
893
link_directories(${WOLFSSL_LIBRARY_DIRS})
894
if(WOLFSSL_CFLAGS)
895
string(APPEND CMAKE_C_FLAGS " ${WOLFSSL_CFLAGS}")
896
endif()
897
898
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "wolfssl")
899
set(_valid_default_ssl_backend TRUE)
900
endif()
901
set(_curl_ca_bundle_supported TRUE)
902
endif()
903
904
if(CURL_USE_GNUTLS)
905
find_package(GnuTLS REQUIRED)
906
list(APPEND CURL_LIBS ${GNUTLS_LIBRARIES})
907
list(APPEND CURL_LIBDIRS ${GNUTLS_LIBRARY_DIRS})
908
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${GNUTLS_PC_REQUIRES})
909
include_directories(SYSTEM ${GNUTLS_INCLUDE_DIRS})
910
link_directories(${GNUTLS_LIBRARY_DIRS})
911
if(GNUTLS_CFLAGS)
912
string(APPEND CMAKE_C_FLAGS " ${GNUTLS_CFLAGS}")
913
endif()
914
915
find_package(Nettle REQUIRED)
916
set(_ssl_enabled ON)
917
set(USE_GNUTLS ON)
918
list(APPEND CURL_LIBS ${NETTLE_LIBRARIES})
919
list(APPEND CURL_LIBDIRS ${NETTLE_LIBRARY_DIRS})
920
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NETTLE_PC_REQUIRES})
921
include_directories(SYSTEM ${NETTLE_INCLUDE_DIRS})
922
link_directories(${NETTLE_LIBRARY_DIRS})
923
if(NETTLE_CFLAGS)
924
string(APPEND CMAKE_C_FLAGS " ${NETTLE_CFLAGS}")
925
endif()
926
927
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "gnutls")
928
set(_valid_default_ssl_backend TRUE)
929
endif()
930
set(_curl_ca_bundle_supported TRUE)
931
932
if(NOT DEFINED HAVE_GNUTLS_SRP AND NOT CURL_DISABLE_SRP)
933
cmake_push_check_state()
934
list(APPEND CMAKE_REQUIRED_INCLUDES "${GNUTLS_INCLUDE_DIRS}")
935
list(APPEND CMAKE_REQUIRED_LIBRARIES "${GNUTLS_LIBRARIES}")
936
curl_required_libpaths("${GNUTLS_LIBRARY_DIRS}")
937
check_symbol_exists("gnutls_srp_verifier" "gnutls/gnutls.h" HAVE_GNUTLS_SRP)
938
cmake_pop_check_state()
939
endif()
940
endif()
941
942
if(CURL_USE_RUSTLS)
943
find_package(Rustls REQUIRED)
944
set(_ssl_enabled ON)
945
set(USE_RUSTLS ON)
946
list(APPEND CURL_LIBS ${RUSTLS_LIBRARIES})
947
list(APPEND CURL_LIBDIRS ${RUSTLS_LIBRARY_DIRS})
948
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${RUSTLS_PC_REQUIRES})
949
include_directories(SYSTEM ${RUSTLS_INCLUDE_DIRS})
950
link_directories(${RUSTLS_LIBRARY_DIRS})
951
if(RUSTLS_CFLAGS)
952
string(APPEND CMAKE_C_FLAGS " ${RUSTLS_CFLAGS}")
953
endif()
954
955
if(NOT DEFINED HAVE_RUSTLS_SUPPORTED_HPKE)
956
if(RUSTLS_VERSION AND RUSTLS_VERSION VERSION_GREATER_EQUAL 0.15)
957
set(HAVE_RUSTLS_SUPPORTED_HPKE TRUE)
958
elseif(NOT RUSTLS_VERSION)
959
cmake_push_check_state()
960
list(APPEND CMAKE_REQUIRED_INCLUDES "${RUSTLS_INCLUDE_DIRS}")
961
list(APPEND CMAKE_REQUIRED_LIBRARIES "${RUSTLS_LIBRARIES}")
962
curl_required_libpaths("${RUSTLS_LIBRARY_DIRS}")
963
check_symbol_exists("rustls_supported_hpke" "rustls.h" HAVE_RUSTLS_SUPPORTED_HPKE)
964
cmake_pop_check_state()
965
endif()
966
endif()
967
if(NOT HAVE_RUSTLS_SUPPORTED_HPKE)
968
message(FATAL_ERROR "rustls-ffi library does not provide rustls_supported_hpke function. Required version is 0.15 or newer.")
969
endif()
970
971
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "rustls")
972
set(_valid_default_ssl_backend TRUE)
973
endif()
974
set(_curl_ca_bundle_supported TRUE)
975
endif()
976
977
if(CURL_DEFAULT_SSL_BACKEND AND NOT _valid_default_ssl_backend)
978
message(FATAL_ERROR "CURL_DEFAULT_SSL_BACKEND '${CURL_DEFAULT_SSL_BACKEND}' not enabled.")
979
endif()
980
981
# Keep ZLIB detection after TLS detection,
982
# and before calling curl_openssl_check_exists().
983
984
set(HAVE_LIBZ OFF)
985
curl_dependency_option(CURL_ZLIB ZLIB "ZLIB")
986
if(ZLIB_FOUND)
987
set(HAVE_LIBZ ON)
988
# Depend on ZLIB via imported targets. This allows our dependents to
989
# get our dependencies transitively.
990
list(APPEND CURL_LIBS ZLIB::ZLIB)
991
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "zlib")
992
endif()
993
994
set(HAVE_BROTLI OFF)
995
curl_dependency_option(CURL_BROTLI Brotli "brotli")
996
if(BROTLI_FOUND)
997
set(HAVE_BROTLI ON)
998
list(APPEND CURL_LIBS ${BROTLI_LIBRARIES})
999
list(APPEND CURL_LIBDIRS ${BROTLI_LIBRARY_DIRS})
1000
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${BROTLI_PC_REQUIRES})
1001
include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS})
1002
link_directories(${BROTLI_LIBRARY_DIRS})
1003
if(BROTLI_CFLAGS)
1004
string(APPEND CMAKE_C_FLAGS " ${BROTLI_CFLAGS}")
1005
endif()
1006
endif()
1007
1008
set(HAVE_ZSTD OFF)
1009
curl_dependency_option(CURL_ZSTD Zstd "zstd")
1010
if(ZSTD_FOUND)
1011
if(ZSTD_VERSION VERSION_GREATER_EQUAL 1.0.0)
1012
set(HAVE_ZSTD ON)
1013
list(APPEND CURL_LIBS ${ZSTD_LIBRARIES})
1014
list(APPEND CURL_LIBDIRS ${ZSTD_LIBRARY_DIRS})
1015
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${ZSTD_PC_REQUIRES})
1016
include_directories(SYSTEM ${ZSTD_INCLUDE_DIRS})
1017
link_directories(${ZSTD_LIBRARY_DIRS})
1018
if(ZSTD_CFLAGS)
1019
string(APPEND CMAKE_C_FLAGS " ${ZSTD_CFLAGS}")
1020
endif()
1021
else()
1022
message(WARNING "zstd v1.0.0 or newer is required, disabling zstd support.")
1023
endif()
1024
endif()
1025
1026
# Check function in an OpenSSL-like TLS backend.
1027
macro(curl_openssl_check_exists)
1028
cmake_push_check_state()
1029
if(USE_OPENSSL)
1030
list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
1031
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DOPENSSL_SUPPRESS_DEPRECATED") # for SSL_CTX_set_srp_username deprecated since 3.0.0
1032
if(HAVE_LIBZ)
1033
list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB)
1034
endif()
1035
if(WIN32 AND NOT WINCE)
1036
list(APPEND CMAKE_REQUIRED_LIBRARIES "bcrypt") # for OpenSSL/LibreSSL
1037
endif()
1038
endif()
1039
if(USE_WOLFSSL)
1040
list(APPEND CMAKE_REQUIRED_INCLUDES "${WOLFSSL_INCLUDE_DIRS}")
1041
list(APPEND CMAKE_REQUIRED_LIBRARIES "${WOLFSSL_LIBRARIES}")
1042
curl_required_libpaths("${WOLFSSL_LIBRARY_DIRS}")
1043
if(HAVE_LIBZ)
1044
list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB) # Public wolfSSL headers also require zlib headers
1045
endif()
1046
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DHAVE_UINTPTR_T") # to pull in stdint.h (as of wolfSSL v5.5.4)
1047
endif()
1048
if(WIN32)
1049
list(APPEND CMAKE_REQUIRED_LIBRARIES "${_win32_winsock}" "${_win32_crypt32}") # for OpenSSL/wolfSSL
1050
endif()
1051
if(${ARGC} EQUAL 2)
1052
check_function_exists(${ARGN})
1053
else()
1054
check_symbol_exists(${ARGN}) # Uses CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_DEFINITIONS
1055
endif()
1056
cmake_pop_check_state()
1057
endmacro()
1058
1059
# Ensure that OpenSSL (or fork) or wolfSSL actually supports QUICTLS API.
1060
macro(curl_openssl_check_quic)
1061
if(USE_OPENSSL AND NOT USE_OPENSSL_QUIC)
1062
if(OPENSSL_VERSION VERSION_GREATER_EQUAL 3.5.0)
1063
if(NOT DEFINED HAVE_SSL_SET_QUIC_TLS_CBS)
1064
curl_openssl_check_exists("SSL_set_quic_tls_cbs" HAVE_SSL_SET_QUIC_TLS_CBS)
1065
endif()
1066
else()
1067
if(NOT DEFINED HAVE_SSL_SET_QUIC_USE_LEGACY_CODEPOINT)
1068
curl_openssl_check_exists("SSL_set_quic_use_legacy_codepoint" HAVE_SSL_SET_QUIC_USE_LEGACY_CODEPOINT)
1069
endif()
1070
endif()
1071
endif()
1072
if(USE_WOLFSSL AND NOT DEFINED HAVE_WOLFSSL_SET_QUIC_USE_LEGACY_CODEPOINT)
1073
curl_openssl_check_exists("wolfSSL_set_quic_use_legacy_codepoint" HAVE_WOLFSSL_SET_QUIC_USE_LEGACY_CODEPOINT)
1074
endif()
1075
if(NOT HAVE_SSL_SET_QUIC_TLS_CBS AND
1076
NOT HAVE_SSL_SET_QUIC_USE_LEGACY_CODEPOINT AND
1077
NOT HAVE_WOLFSSL_SET_QUIC_USE_LEGACY_CODEPOINT)
1078
message(FATAL_ERROR "QUICTLS API support is missing from OpenSSL/fork/wolfSSL. Try setting -DOPENSSL_ROOT_DIR")
1079
endif()
1080
endmacro()
1081
1082
if(USE_WOLFSSL)
1083
curl_openssl_check_exists("wolfSSL_get_peer_certificate" HAVE_WOLFSSL_GET_PEER_CERTIFICATE)
1084
curl_openssl_check_exists("wolfSSL_UseALPN" HAVE_WOLFSSL_USEALPN)
1085
curl_openssl_check_exists("wolfSSL_DES_ecb_encrypt" HAVE_WOLFSSL_DES_ECB_ENCRYPT)
1086
curl_openssl_check_exists("wolfSSL_BIO_new" HAVE_WOLFSSL_BIO_NEW)
1087
curl_openssl_check_exists("wolfSSL_BIO_set_shutdown" HAVE_WOLFSSL_BIO_SET_SHUTDOWN)
1088
endif()
1089
1090
if(USE_OPENSSL)
1091
if(NOT DEFINED HAVE_DES_ECB_ENCRYPT)
1092
curl_openssl_check_exists("DES_ecb_encrypt" "openssl/des.h" HAVE_DES_ECB_ENCRYPT)
1093
endif()
1094
if(NOT DEFINED HAVE_SSL_SET0_WBIO)
1095
curl_openssl_check_exists("SSL_set0_wbio" HAVE_SSL_SET0_WBIO)
1096
endif()
1097
if(NOT DEFINED HAVE_OPENSSL_SRP AND NOT CURL_DISABLE_SRP)
1098
curl_openssl_check_exists("SSL_CTX_set_srp_username" "openssl/ssl.h" HAVE_OPENSSL_SRP)
1099
endif()
1100
endif()
1101
1102
option(USE_HTTPSRR "Enable HTTPS RR support" OFF)
1103
option(USE_ECH "Enable ECH support" OFF)
1104
if(USE_ECH)
1105
if(USE_OPENSSL OR USE_WOLFSSL OR USE_RUSTLS)
1106
# Be sure that the TLS library actually supports ECH.
1107
if(USE_WOLFSSL)
1108
curl_openssl_check_exists("wolfSSL_CTX_GenerateEchConfig" HAVE_WOLFSSL_CTX_GENERATEECHCONFIG)
1109
endif()
1110
if(USE_OPENSSL)
1111
curl_openssl_check_exists("SSL_set1_ech_config_list" HAVE_SSL_SET1_ECH_CONFIG_LIST)
1112
endif()
1113
if(HAVE_WOLFSSL_CTX_GENERATEECHCONFIG OR
1114
HAVE_SSL_SET1_ECH_CONFIG_LIST OR
1115
USE_RUSTLS)
1116
set(HAVE_ECH 1)
1117
endif()
1118
if(NOT HAVE_ECH)
1119
message(FATAL_ERROR "ECH support missing in OpenSSL/BoringSSL/AWS-LC/wolfSSL/rustls-ffi")
1120
else()
1121
message(STATUS "ECH enabled")
1122
# ECH wants HTTPSRR
1123
set(USE_HTTPSRR ON)
1124
message(STATUS "HTTPSRR enabled")
1125
endif()
1126
else()
1127
message(FATAL_ERROR "ECH requires ECH-enabled OpenSSL, BoringSSL, AWS-LC, wolfSSL or rustls-ffi")
1128
endif()
1129
endif()
1130
1131
option(USE_SSLS_EXPORT "Enable SSL session export support" OFF)
1132
if(USE_SSLS_EXPORT)
1133
if(_ssl_enabled)
1134
message(STATUS "SSL export enabled.")
1135
else()
1136
message(WARNING "SSL session export requires SSL enabled")
1137
endif()
1138
endif()
1139
1140
option(USE_NGHTTP2 "Use nghttp2 library" ON)
1141
if(USE_NGHTTP2)
1142
find_package(NGHTTP2)
1143
if(NGHTTP2_FOUND)
1144
list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES})
1145
list(APPEND CURL_LIBDIRS ${NGHTTP2_LIBRARY_DIRS})
1146
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NGHTTP2_PC_REQUIRES})
1147
include_directories(SYSTEM ${NGHTTP2_INCLUDE_DIRS})
1148
link_directories(${NGHTTP2_LIBRARY_DIRS})
1149
if(NGHTTP2_CFLAGS)
1150
string(APPEND CMAKE_C_FLAGS " ${NGHTTP2_CFLAGS}")
1151
endif()
1152
else()
1153
set(USE_NGHTTP2 OFF)
1154
endif()
1155
endif()
1156
1157
option(USE_NGTCP2 "Use ngtcp2 and nghttp3 libraries for HTTP/3 support" OFF)
1158
if(USE_NGTCP2)
1159
if(CURL_WITH_MULTI_SSL)
1160
message(FATAL_ERROR "MultiSSL cannot be enabled with HTTP/3 and vice versa.")
1161
elseif(USE_OPENSSL OR USE_WOLFSSL)
1162
if(USE_WOLFSSL)
1163
find_package(NGTCP2 REQUIRED COMPONENTS "wolfSSL")
1164
elseif(HAVE_BORINGSSL OR HAVE_AWSLC)
1165
find_package(NGTCP2 REQUIRED COMPONENTS "BoringSSL")
1166
elseif(OPENSSL_VERSION VERSION_GREATER_EQUAL 3.5.0 AND NOT USE_OPENSSL_QUIC)
1167
find_package(NGTCP2 REQUIRED COMPONENTS "ossl")
1168
if(NGTCP2_VERSION VERSION_LESS 1.12.0)
1169
message(FATAL_ERROR "ngtcp2 1.12.0 or upper required for OpenSSL")
1170
endif()
1171
set(OPENSSL_QUIC_API2 1)
1172
elseif(HAVE_LIBRESSL)
1173
find_package(NGTCP2 COMPONENTS "LibreSSL")
1174
if(NOT NGTCP2_FOUND)
1175
find_package(NGTCP2 REQUIRED COMPONENTS "quictls") # for ngtcp2 <1.15.0
1176
endif()
1177
else()
1178
find_package(NGTCP2 REQUIRED COMPONENTS "quictls")
1179
set(_openssl "quictls")
1180
endif()
1181
curl_openssl_check_quic()
1182
elseif(USE_GNUTLS)
1183
find_package(NGTCP2 REQUIRED "GnuTLS")
1184
else()
1185
message(FATAL_ERROR "ngtcp2 requires a supported TLS-backend")
1186
endif()
1187
list(APPEND CURL_LIBS ${NGTCP2_LIBRARIES})
1188
list(APPEND CURL_LIBDIRS ${NGTCP2_LIBRARY_DIRS})
1189
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NGTCP2_PC_REQUIRES})
1190
include_directories(SYSTEM ${NGTCP2_INCLUDE_DIRS})
1191
link_directories(${NGTCP2_LIBRARY_DIRS})
1192
if(NGTCP2_CFLAGS)
1193
string(APPEND CMAKE_C_FLAGS " ${NGTCP2_CFLAGS}")
1194
endif()
1195
1196
find_package(NGHTTP3 REQUIRED)
1197
set(USE_NGHTTP3 ON)
1198
list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES})
1199
list(APPEND CURL_LIBDIRS ${NGHTTP3_LIBRARY_DIRS})
1200
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NGHTTP3_PC_REQUIRES})
1201
include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS})
1202
link_directories(${NGHTTP3_LIBRARY_DIRS})
1203
if(NGHTTP3_CFLAGS)
1204
string(APPEND CMAKE_C_FLAGS " ${NGHTTP3_CFLAGS}")
1205
endif()
1206
endif()
1207
1208
option(USE_QUICHE "Use quiche library for HTTP/3 support" OFF)
1209
if(USE_QUICHE)
1210
if(USE_NGTCP2)
1211
message(FATAL_ERROR "Only one HTTP/3 backend can be selected")
1212
elseif(CURL_WITH_MULTI_SSL)
1213
message(FATAL_ERROR "MultiSSL cannot be enabled with HTTP/3 and vice versa.")
1214
endif()
1215
find_package(Quiche REQUIRED)
1216
if(NOT HAVE_BORINGSSL)
1217
message(FATAL_ERROR "quiche requires BoringSSL")
1218
endif()
1219
curl_openssl_check_quic()
1220
list(APPEND CURL_LIBS ${QUICHE_LIBRARIES})
1221
list(APPEND CURL_LIBDIRS ${QUICHE_LIBRARY_DIRS})
1222
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${QUICHE_PC_REQUIRES})
1223
include_directories(SYSTEM ${QUICHE_INCLUDE_DIRS})
1224
link_directories(${QUICHE_LIBRARY_DIRS})
1225
if(QUICHE_CFLAGS)
1226
string(APPEND CMAKE_C_FLAGS " ${QUICHE_CFLAGS}")
1227
endif()
1228
if(NOT DEFINED HAVE_QUICHE_CONN_SET_QLOG_FD)
1229
cmake_push_check_state()
1230
list(APPEND CMAKE_REQUIRED_INCLUDES "${QUICHE_INCLUDE_DIRS}")
1231
list(APPEND CMAKE_REQUIRED_LIBRARIES "${QUICHE_LIBRARIES}")
1232
check_symbol_exists("quiche_conn_set_qlog_fd" "quiche.h" HAVE_QUICHE_CONN_SET_QLOG_FD)
1233
cmake_pop_check_state()
1234
endif()
1235
endif()
1236
1237
if(USE_OPENSSL_QUIC)
1238
if(USE_NGTCP2 OR USE_QUICHE)
1239
message(FATAL_ERROR "Only one HTTP/3 backend can be selected")
1240
elseif(CURL_WITH_MULTI_SSL)
1241
message(FATAL_ERROR "MultiSSL cannot be enabled with HTTP/3 and vice versa.")
1242
endif()
1243
find_package(OpenSSL 3.3.0 REQUIRED)
1244
1245
find_package(NGHTTP3 REQUIRED)
1246
set(USE_NGHTTP3 ON)
1247
list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES})
1248
list(APPEND CURL_LIBDIRS ${NGHTTP3_LIBRARY_DIRS})
1249
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${NGHTTP3_PC_REQUIRES})
1250
include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS})
1251
link_directories(${NGHTTP3_LIBRARY_DIRS})
1252
if(NGHTTP3_CFLAGS)
1253
string(APPEND CMAKE_C_FLAGS " ${NGHTTP3_CFLAGS}")
1254
endif()
1255
endif()
1256
1257
if(NOT CURL_DISABLE_SRP AND (HAVE_GNUTLS_SRP OR HAVE_OPENSSL_SRP))
1258
set(USE_TLS_SRP 1)
1259
endif()
1260
1261
if(NOT CURL_DISABLE_LDAP)
1262
if(WIN32 AND NOT WINDOWS_STORE AND NOT WINCE)
1263
option(USE_WIN32_LDAP "Use Windows LDAP implementation" ON)
1264
if(USE_WIN32_LDAP)
1265
list(APPEND CURL_LIBS "wldap32")
1266
if(NOT CURL_DISABLE_LDAPS)
1267
set(HAVE_LDAP_SSL ON)
1268
endif()
1269
endif()
1270
endif()
1271
1272
# Now that we know, we are not using Windows LDAP...
1273
if(NOT USE_WIN32_LDAP)
1274
# Check for LDAP
1275
cmake_push_check_state()
1276
if(USE_OPENSSL)
1277
list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
1278
endif()
1279
find_package(LDAP)
1280
if(LDAP_FOUND)
1281
set(HAVE_LBER_H 1)
1282
set(CURL_LIBS ${LDAP_LIBRARIES} ${CURL_LIBS})
1283
list(APPEND CURL_LIBDIRS ${LDAP_LIBRARY_DIRS})
1284
if(LDAP_PC_REQUIRES)
1285
set(LIBCURL_PC_REQUIRES_PRIVATE ${LDAP_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
1286
endif()
1287
include_directories(SYSTEM ${LDAP_INCLUDE_DIRS})
1288
link_directories(${LDAP_LIBRARY_DIRS})
1289
if(LDAP_CFLAGS)
1290
string(APPEND CMAKE_C_FLAGS " ${LDAP_CFLAGS}")
1291
endif()
1292
1293
# LDAP feature checks
1294
1295
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DLDAP_DEPRECATED=1")
1296
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LDAP_LIBRARIES}")
1297
curl_required_libpaths("${LDAP_LIBRARY_DIRS}")
1298
1299
check_function_exists("ldap_url_parse" HAVE_LDAP_URL_PARSE)
1300
check_function_exists("ldap_init_fd" HAVE_LDAP_INIT_FD)
1301
1302
check_include_file("ldap_ssl.h" HAVE_LDAP_SSL_H)
1303
1304
if(HAVE_LDAP_INIT_FD)
1305
set(USE_OPENLDAP ON)
1306
endif()
1307
if(NOT CURL_DISABLE_LDAPS)
1308
set(HAVE_LDAP_SSL ON)
1309
endif()
1310
else()
1311
message(STATUS "LDAP not found. CURL_DISABLE_LDAP set ON")
1312
set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
1313
endif()
1314
cmake_pop_check_state()
1315
endif()
1316
endif()
1317
1318
# No ldap, no ldaps.
1319
if(CURL_DISABLE_LDAP)
1320
if(NOT CURL_DISABLE_LDAPS)
1321
message(STATUS "LDAP needs to be enabled to support LDAPS")
1322
set(CURL_DISABLE_LDAPS ON CACHE BOOL "" FORCE)
1323
endif()
1324
endif()
1325
1326
if(WIN32)
1327
option(USE_WIN32_IDN "Use WinIDN for IDN support" OFF)
1328
if(USE_WIN32_IDN)
1329
list(APPEND CURL_LIBS "normaliz")
1330
endif()
1331
else()
1332
set(USE_WIN32_IDN OFF)
1333
endif()
1334
1335
if(APPLE)
1336
option(USE_APPLE_IDN "Use Apple built-in IDN support" OFF)
1337
if(USE_APPLE_IDN)
1338
cmake_push_check_state()
1339
list(APPEND CMAKE_REQUIRED_LIBRARIES "icucore")
1340
check_symbol_exists("uidna_openUTS46" "unicode/uidna.h" HAVE_APPLE_IDN)
1341
cmake_pop_check_state()
1342
if(HAVE_APPLE_IDN)
1343
list(APPEND CURL_LIBS "icucore" "iconv")
1344
else()
1345
set(USE_APPLE_IDN OFF)
1346
endif()
1347
endif()
1348
else()
1349
set(USE_APPLE_IDN OFF)
1350
endif()
1351
1352
# Check for libidn2
1353
option(USE_LIBIDN2 "Use libidn2 for IDN support" ON)
1354
set(HAVE_IDN2_H OFF)
1355
set(HAVE_LIBIDN2 OFF)
1356
if(USE_LIBIDN2 AND NOT USE_APPLE_IDN AND NOT USE_WIN32_IDN)
1357
find_package(Libidn2)
1358
if(LIBIDN2_FOUND)
1359
set(CURL_LIBS ${LIBIDN2_LIBRARIES} ${CURL_LIBS})
1360
list(APPEND CURL_LIBDIRS ${LIBIDN2_LIBRARY_DIRS})
1361
set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBIDN2_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
1362
include_directories(SYSTEM ${LIBIDN2_INCLUDE_DIRS})
1363
link_directories(${LIBIDN2_LIBRARY_DIRS})
1364
if(LIBIDN2_CFLAGS)
1365
string(APPEND CMAKE_C_FLAGS " ${LIBIDN2_CFLAGS}")
1366
endif()
1367
set(HAVE_IDN2_H 1)
1368
set(HAVE_LIBIDN2 1)
1369
endif()
1370
endif()
1371
1372
# libpsl
1373
option(CURL_USE_LIBPSL "Use libpsl" ON)
1374
mark_as_advanced(CURL_USE_LIBPSL)
1375
set(USE_LIBPSL OFF)
1376
1377
if(CURL_USE_LIBPSL)
1378
find_package(Libpsl REQUIRED)
1379
list(APPEND CURL_LIBS ${LIBPSL_LIBRARIES})
1380
list(APPEND CURL_LIBDIRS ${LIBPSL_LIBRARY_DIRS})
1381
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBPSL_PC_REQUIRES})
1382
include_directories(SYSTEM ${LIBPSL_INCLUDE_DIRS})
1383
link_directories(${LIBPSL_LIBRARY_DIRS})
1384
if(LIBPSL_CFLAGS)
1385
string(APPEND CMAKE_C_FLAGS " ${LIBPSL_CFLAGS}")
1386
endif()
1387
set(USE_LIBPSL ON)
1388
endif()
1389
1390
# libssh2
1391
option(CURL_USE_LIBSSH2 "Use libssh2" ON)
1392
mark_as_advanced(CURL_USE_LIBSSH2)
1393
set(USE_LIBSSH2 OFF)
1394
1395
if(CURL_USE_LIBSSH2)
1396
find_package(Libssh2)
1397
if(LIBSSH2_FOUND)
1398
set(CURL_LIBS ${LIBSSH2_LIBRARIES} ${CURL_LIBS}) # keep it before TLS-crypto, compression
1399
list(APPEND CURL_LIBDIRS ${LIBSSH2_LIBRARY_DIRS})
1400
set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH2_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
1401
include_directories(SYSTEM ${LIBSSH2_INCLUDE_DIRS})
1402
link_directories(${LIBSSH2_LIBRARY_DIRS})
1403
if(LIBSSH2_CFLAGS)
1404
string(APPEND CMAKE_C_FLAGS " ${LIBSSH2_CFLAGS}")
1405
endif()
1406
set(USE_LIBSSH2 ON)
1407
endif()
1408
endif()
1409
1410
# libssh
1411
option(CURL_USE_LIBSSH "Use libssh" OFF)
1412
mark_as_advanced(CURL_USE_LIBSSH)
1413
if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
1414
find_package(Libssh REQUIRED)
1415
set(CURL_LIBS ${LIBSSH_LIBRARIES} ${CURL_LIBS}) # keep it before TLS-crypto, compression
1416
list(APPEND CURL_LIBDIRS ${LIBSSH_LIBRARY_DIRS})
1417
set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
1418
include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS})
1419
link_directories(${LIBSSH_LIBRARY_DIRS})
1420
if(LIBSSH_CFLAGS)
1421
string(APPEND CMAKE_C_FLAGS " ${LIBSSH_CFLAGS}")
1422
endif()
1423
set(USE_LIBSSH ON)
1424
endif()
1425
1426
option(CURL_USE_GSASL "Use libgsasl" OFF)
1427
mark_as_advanced(CURL_USE_GSASL)
1428
if(CURL_USE_GSASL)
1429
find_package(Libgsasl REQUIRED)
1430
list(APPEND CURL_LIBS ${LIBGSASL_LIBRARIES})
1431
list(APPEND CURL_LIBDIRS ${LIBGSASL_LIBRARY_DIRS})
1432
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBGSASL_PC_REQUIRES})
1433
include_directories(SYSTEM ${LIBGSASL_INCLUDE_DIRS})
1434
link_directories(${LIBGSASL_LIBRARY_DIRS})
1435
if(LIBGSASL_CFLAGS)
1436
string(APPEND CMAKE_C_FLAGS " ${LIBGSASL_CFLAGS}")
1437
endif()
1438
set(USE_GSASL ON)
1439
endif()
1440
1441
option(CURL_USE_GSSAPI "Use GSSAPI implementation" OFF)
1442
mark_as_advanced(CURL_USE_GSSAPI)
1443
1444
if(CURL_USE_GSSAPI)
1445
find_package(GSS)
1446
1447
set(HAVE_GSSAPI ${GSS_FOUND})
1448
if(GSS_FOUND)
1449
list(APPEND CURL_LIBS ${GSS_LIBRARIES})
1450
list(APPEND CURL_LIBDIRS ${GSS_LIBRARY_DIRS})
1451
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${GSS_PC_REQUIRES})
1452
include_directories(SYSTEM ${GSS_INCLUDE_DIRS})
1453
link_directories(${GSS_LIBRARY_DIRS})
1454
if(GSS_CFLAGS)
1455
string(APPEND CMAKE_C_FLAGS " ${GSS_CFLAGS}")
1456
endif()
1457
1458
if(GSS_FLAVOUR STREQUAL "GNU")
1459
set(HAVE_GSSGNU 1)
1460
elseif(GSS_VERSION) # MIT
1461
set(CURL_KRB5_VERSION "\"${GSS_VERSION}\"")
1462
endif()
1463
else()
1464
message(WARNING "GSSAPI has been requested, but no supporting libraries found. Skipping.")
1465
endif()
1466
endif()
1467
1468
# libuv
1469
option(CURL_USE_LIBUV "Use libuv for event-based tests" OFF)
1470
if(CURL_USE_LIBUV)
1471
if(NOT ENABLE_DEBUG)
1472
message(FATAL_ERROR "Using libuv without debug support enabled is useless")
1473
endif()
1474
find_package(Libuv REQUIRED)
1475
list(APPEND CURL_LIBS ${LIBUV_LIBRARIES})
1476
list(APPEND CURL_LIBDIRS ${LIBUV_LIBRARY_DIRS})
1477
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBUV_PC_REQUIRES})
1478
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
1479
link_directories(${LIBUV_LIBRARY_DIRS})
1480
if(LIBUV_CFLAGS)
1481
string(APPEND CMAKE_C_FLAGS " ${LIBUV_CFLAGS}")
1482
endif()
1483
set(USE_LIBUV ON)
1484
set(HAVE_UV_H ON)
1485
endif()
1486
1487
option(USE_LIBRTMP "Enable librtmp from rtmpdump" OFF)
1488
if(USE_LIBRTMP)
1489
find_package(Librtmp REQUIRED)
1490
list(APPEND CURL_LIBS ${LIBRTMP_LIBRARIES})
1491
list(APPEND CURL_LIBDIRS ${LIBRTMP_LIBRARY_DIRS})
1492
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBRTMP_PC_REQUIRES})
1493
include_directories(SYSTEM ${LIBRTMP_INCLUDE_DIRS})
1494
link_directories(${LIBRTMP_LIBRARY_DIRS})
1495
if(LIBRTMP_CFLAGS)
1496
string(APPEND CMAKE_C_FLAGS " ${LIBRTMP_CFLAGS}")
1497
endif()
1498
endif()
1499
1500
option(ENABLE_UNIX_SOCKETS "Enable Unix domain sockets support" ON)
1501
if(ENABLE_UNIX_SOCKETS AND NOT WINCE)
1502
if(WIN32 OR DOS)
1503
set(USE_UNIX_SOCKETS 1)
1504
else()
1505
include(CheckStructHasMember)
1506
check_struct_has_member("struct sockaddr_un" "sun_path" "sys/un.h" USE_UNIX_SOCKETS)
1507
endif()
1508
else()
1509
set(USE_UNIX_SOCKETS 0)
1510
unset(USE_UNIX_SOCKETS CACHE)
1511
endif()
1512
1513
#
1514
# CA handling
1515
#
1516
if(_curl_ca_bundle_supported)
1517
set(_ca_opt_desc "Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
1518
1519
set(CURL_CA_BUNDLE "auto" CACHE
1520
STRING "Absolute path to the CA bundle. ${_ca_opt_desc}")
1521
set(CURL_CA_FALLBACK OFF CACHE
1522
BOOL "Use built-in CA store of OpenSSL. Defaults to OFF")
1523
set(CURL_CA_PATH "auto" CACHE
1524
STRING "Absolute path to a directory containing CA certificates stored individually. ${_ca_opt_desc}")
1525
set(CURL_CA_EMBED "" CACHE
1526
STRING "Absolute path to the CA bundle to embed in the curl tool.")
1527
1528
if(CURL_CA_FALLBACK AND NOT CURL_USE_OPENSSL)
1529
message(FATAL_ERROR "CURL_CA_FALLBACK only works with OpenSSL.")
1530
endif()
1531
1532
if(CURL_CA_BUNDLE STREQUAL "")
1533
message(FATAL_ERROR "Invalid value of CURL_CA_BUNDLE. Use 'none', 'auto' or file path.")
1534
elseif(CURL_CA_BUNDLE STREQUAL "none")
1535
unset(CURL_CA_BUNDLE CACHE)
1536
elseif(CURL_CA_BUNDLE STREQUAL "auto")
1537
unset(CURL_CA_BUNDLE CACHE)
1538
if(NOT CMAKE_CROSSCOMPILING AND NOT WIN32 AND NOT USE_APPLE_SECTRUST)
1539
set(_curl_ca_bundle_autodetect TRUE)
1540
endif()
1541
else()
1542
set(CURL_CA_BUNDLE_SET TRUE)
1543
endif()
1544
mark_as_advanced(CURL_CA_BUNDLE_SET)
1545
1546
if(CURL_CA_PATH STREQUAL "")
1547
message(FATAL_ERROR "Invalid value of CURL_CA_PATH. Use 'none', 'auto' or directory path.")
1548
elseif(CURL_CA_PATH STREQUAL "none")
1549
unset(CURL_CA_PATH CACHE)
1550
elseif(CURL_CA_PATH STREQUAL "auto")
1551
unset(CURL_CA_PATH CACHE)
1552
if(NOT CMAKE_CROSSCOMPILING AND NOT WIN32)
1553
set(_curl_ca_path_autodetect TRUE)
1554
endif()
1555
else()
1556
set(CURL_CA_PATH_SET TRUE)
1557
endif()
1558
mark_as_advanced(CURL_CA_PATH_SET)
1559
1560
if(CURL_CA_BUNDLE_SET AND _curl_ca_path_autodetect)
1561
# Skip auto-detection of unset CA path because CA bundle is set explicitly
1562
elseif(CURL_CA_PATH_SET AND _curl_ca_bundle_autodetect)
1563
# Skip auto-detection of unset CA bundle because CA path is set explicitly
1564
elseif(_curl_ca_bundle_autodetect OR _curl_ca_path_autodetect)
1565
# First try auto-detecting a CA bundle, then a CA path
1566
1567
if(_curl_ca_bundle_autodetect)
1568
foreach(_search_ca_bundle_path IN ITEMS
1569
"/etc/ssl/certs/ca-certificates.crt"
1570
"/etc/pki/tls/certs/ca-bundle.crt"
1571
"/usr/share/ssl/certs/ca-bundle.crt"
1572
"/usr/local/share/certs/ca-root-nss.crt"
1573
"/etc/ssl/cert.pem")
1574
if(EXISTS "${_search_ca_bundle_path}")
1575
message(STATUS "Found CA bundle: ${_search_ca_bundle_path}")
1576
set(CURL_CA_BUNDLE "${_search_ca_bundle_path}" CACHE
1577
STRING "Absolute path to the CA bundle. ${_ca_opt_desc}")
1578
set(CURL_CA_BUNDLE_SET TRUE CACHE BOOL "Absolute path to the CA bundle has been set")
1579
break()
1580
endif()
1581
endforeach()
1582
endif()
1583
1584
if(_curl_ca_path_autodetect AND NOT CURL_CA_PATH_SET)
1585
set(_search_ca_path "/etc/ssl/certs")
1586
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")
1587
if(_curl_ca_files_found)
1588
unset(_curl_ca_files_found)
1589
message(STATUS "Found CA path: ${_search_ca_path}")
1590
set(CURL_CA_PATH "${_search_ca_path}" CACHE
1591
STRING "Absolute path to a directory containing CA certificates stored individually. ${_ca_opt_desc}")
1592
set(CURL_CA_PATH_SET TRUE CACHE BOOL "Absolute path to the CA bundle has been set")
1593
endif()
1594
endif()
1595
endif()
1596
1597
set(CURL_CA_EMBED_SET FALSE)
1598
if(BUILD_CURL_EXE AND NOT CURL_CA_EMBED STREQUAL "")
1599
if(EXISTS "${CURL_CA_EMBED}")
1600
set(CURL_CA_EMBED_SET TRUE)
1601
message(STATUS "Found CA bundle to embed: ${CURL_CA_EMBED}")
1602
else()
1603
message(FATAL_ERROR "CA bundle to embed is missing: '${CURL_CA_EMBED}'")
1604
endif()
1605
endif()
1606
endif()
1607
1608
if(WIN32)
1609
option(CURL_DISABLE_CA_SEARCH "Disable unsafe CA bundle search in PATH on Windows" OFF)
1610
option(CURL_CA_SEARCH_SAFE "Enable safe CA bundle search (within the curl tool directory) on Windows" OFF)
1611
endif()
1612
1613
# Check for header files
1614
if(WIN32)
1615
list(APPEND CURL_INCLUDES "winsock2.h")
1616
list(APPEND CURL_INCLUDES "ws2tcpip.h")
1617
1618
if(HAVE_WIN32_WINNT AND HAVE_WIN32_WINNT LESS 0x0501 AND NOT WINCE)
1619
# Windows XP is required for freeaddrinfo, getaddrinfo
1620
message(FATAL_ERROR "Building for Windows XP or newer is required.")
1621
endif()
1622
1623
# Pre-fill detection results based on target OS version
1624
if(_CURL_PREFILL)
1625
if(NOT HAVE_WIN32_WINNT OR HAVE_WIN32_WINNT LESS 0x0600 OR # older than Windows Vista
1626
WINCE OR WINDOWS_STORE)
1627
set(HAVE_IF_NAMETOINDEX 0)
1628
unset(HAVE_IF_NAMETOINDEX CACHE)
1629
elseif(MSVC OR MINGW)
1630
set(HAVE_IF_NAMETOINDEX 1)
1631
unset(HAVE_IF_NAMETOINDEX CACHE)
1632
endif()
1633
endif()
1634
endif()
1635
1636
if(NOT WIN32)
1637
list(APPEND CURL_INCLUDES "sys/socket.h")
1638
endif()
1639
if(NOT WIN32 OR MINGW)
1640
list(APPEND CURL_INCLUDES "sys/time.h")
1641
endif()
1642
1643
# Detect headers
1644
1645
# Use check_include_file_concat_curl() for headers required by subsequent
1646
# check_include_file_concat_curl() or check_symbol_exists() detections.
1647
# Order for these is significant.
1648
check_include_file("sys/eventfd.h" HAVE_SYS_EVENTFD_H)
1649
check_include_file("sys/filio.h" HAVE_SYS_FILIO_H)
1650
check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
1651
check_include_file("sys/param.h" HAVE_SYS_PARAM_H)
1652
check_include_file("sys/poll.h" HAVE_SYS_POLL_H)
1653
check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
1654
check_include_file_concat_curl("sys/select.h" HAVE_SYS_SELECT_H)
1655
check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H)
1656
check_include_file_concat_curl("sys/types.h" HAVE_SYS_TYPES_H)
1657
check_include_file("sys/un.h" HAVE_SYS_UN_H)
1658
check_include_file_concat_curl("sys/utime.h" HAVE_SYS_UTIME_H) # sys/types.h (AmigaOS)
1659
1660
check_include_file_concat_curl("arpa/inet.h" HAVE_ARPA_INET_H)
1661
check_include_file("dirent.h" HAVE_DIRENT_H)
1662
check_include_file("fcntl.h" HAVE_FCNTL_H)
1663
check_include_file_concat_curl("ifaddrs.h" HAVE_IFADDRS_H)
1664
check_include_file("io.h" HAVE_IO_H)
1665
check_include_file_concat_curl("libgen.h" HAVE_LIBGEN_H)
1666
check_include_file("linux/tcp.h" HAVE_LINUX_TCP_H)
1667
check_include_file("locale.h" HAVE_LOCALE_H)
1668
check_include_file_concat_curl("net/if.h" HAVE_NET_IF_H) # sys/select.h (e.g. MS-DOS/Watt-32)
1669
check_include_file_concat_curl("netdb.h" HAVE_NETDB_H)
1670
check_include_file_concat_curl("netinet/in.h" HAVE_NETINET_IN_H)
1671
check_include_file("netinet/in6.h" HAVE_NETINET_IN6_H)
1672
check_include_file_concat_curl("netinet/tcp.h" HAVE_NETINET_TCP_H) # sys/types.h (e.g. Cygwin) netinet/in.h
1673
check_include_file_concat_curl("netinet/udp.h" HAVE_NETINET_UDP_H) # sys/types.h (e.g. Cygwin)
1674
check_include_file("poll.h" HAVE_POLL_H)
1675
check_include_file("pwd.h" HAVE_PWD_H)
1676
check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
1677
check_include_file("stdbool.h" HAVE_STDBOOL_H)
1678
check_include_file("stdint.h" HAVE_STDINT_H)
1679
check_include_file("strings.h" HAVE_STRINGS_H)
1680
check_include_file("stropts.h" HAVE_STROPTS_H)
1681
check_include_file("termio.h" HAVE_TERMIO_H)
1682
check_include_file("termios.h" HAVE_TERMIOS_H)
1683
check_include_file_concat_curl("unistd.h" HAVE_UNISTD_H)
1684
check_include_file("utime.h" HAVE_UTIME_H)
1685
1686
if(AMIGA)
1687
check_include_file_concat_curl("proto/bsdsocket.h" HAVE_PROTO_BSDSOCKET_H)
1688
endif()
1689
1690
# Pass these detection results to curl_internal_test() for use in CurlTests.c
1691
# Add here all feature flags referenced from CurlTests.c
1692
foreach(_variable IN ITEMS
1693
HAVE_STDATOMIC_H
1694
HAVE_STDBOOL_H
1695
HAVE_STROPTS_H
1696
HAVE_SYS_IOCTL_H
1697
HAVE_SYS_TYPES_H
1698
HAVE_UNISTD_H
1699
)
1700
if(${_variable})
1701
string(APPEND CURL_TEST_DEFINES " -D${_variable}")
1702
endif()
1703
endforeach()
1704
1705
check_type_size("size_t" SIZEOF_SIZE_T)
1706
check_type_size("ssize_t" SIZEOF_SSIZE_T)
1707
check_type_size("long long" SIZEOF_LONG_LONG)
1708
check_type_size("long" SIZEOF_LONG)
1709
check_type_size("int" SIZEOF_INT)
1710
check_type_size("__int64" SIZEOF___INT64)
1711
check_type_size("time_t" SIZEOF_TIME_T)
1712
check_type_size("suseconds_t" SIZEOF_SUSECONDS_T)
1713
if(NOT HAVE_SIZEOF_SSIZE_T)
1714
if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
1715
set(ssize_t "long")
1716
endif()
1717
if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
1718
set(ssize_t "__int64")
1719
endif()
1720
endif()
1721
# off_t is sized later, after the HAVE_FILE_OFFSET_BITS test
1722
1723
if(SIZEOF_LONG_LONG)
1724
set(HAVE_LONGLONG 1)
1725
endif()
1726
if(SIZEOF_SUSECONDS_T)
1727
set(HAVE_SUSECONDS_T 1)
1728
endif()
1729
1730
# Check for some functions that are used
1731
1732
# Apply to all feature checks
1733
if(WIN32)
1734
list(APPEND CMAKE_REQUIRED_LIBRARIES "${_win32_winsock}")
1735
if(NOT WINCE AND NOT WINDOWS_STORE)
1736
list(APPEND CMAKE_REQUIRED_LIBRARIES "iphlpapi")
1737
endif()
1738
elseif(HAVE_LIBSOCKET)
1739
list(APPEND CMAKE_REQUIRED_LIBRARIES "socket")
1740
elseif(DOS)
1741
list(APPEND CMAKE_REQUIRED_LIBRARIES "${WATT_ROOT}/lib/libwatt.a")
1742
endif()
1743
1744
check_function_exists("accept4" HAVE_ACCEPT4)
1745
check_function_exists("fnmatch" HAVE_FNMATCH)
1746
check_symbol_exists("basename" "${CURL_INCLUDES};string.h" HAVE_BASENAME) # libgen.h unistd.h
1747
check_symbol_exists("opendir" "dirent.h" HAVE_OPENDIR)
1748
check_function_exists("poll" HAVE_POLL) # poll.h
1749
check_symbol_exists("socket" "${CURL_INCLUDES}" HAVE_SOCKET) # winsock2.h sys/socket.h
1750
check_symbol_exists("socketpair" "${CURL_INCLUDES}" HAVE_SOCKETPAIR) # sys/socket.h
1751
check_symbol_exists("recv" "${CURL_INCLUDES}" HAVE_RECV) # proto/bsdsocket.h sys/types.h sys/socket.h
1752
check_symbol_exists("send" "${CURL_INCLUDES}" HAVE_SEND) # proto/bsdsocket.h sys/types.h sys/socket.h
1753
check_function_exists("sendmsg" HAVE_SENDMSG)
1754
check_function_exists("sendmmsg" HAVE_SENDMMSG)
1755
check_symbol_exists("select" "${CURL_INCLUDES}" HAVE_SELECT) # proto/bsdsocket.h sys/select.h sys/socket.h
1756
check_symbol_exists("strdup" "string.h" HAVE_STRDUP)
1757
check_symbol_exists("memrchr" "string.h" HAVE_MEMRCHR)
1758
check_symbol_exists("alarm" "unistd.h" HAVE_ALARM)
1759
check_symbol_exists("fcntl" "fcntl.h" HAVE_FCNTL)
1760
check_function_exists("getppid" HAVE_GETPPID)
1761
check_function_exists("utimes" HAVE_UTIMES)
1762
1763
check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY) # sys/time.h
1764
check_symbol_exists("closesocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET) # winsock2.h
1765
check_symbol_exists("sigsetjmp" "setjmp.h" HAVE_SIGSETJMP)
1766
check_function_exists("getpass_r" HAVE_GETPASS_R)
1767
check_function_exists("getpwuid" HAVE_GETPWUID)
1768
check_function_exists("getpwuid_r" HAVE_GETPWUID_R)
1769
check_function_exists("geteuid" HAVE_GETEUID)
1770
check_function_exists("utime" HAVE_UTIME)
1771
check_symbol_exists("gmtime_r" "stdlib.h;time.h" HAVE_GMTIME_R)
1772
1773
check_symbol_exists("gethostbyname_r" "netdb.h" HAVE_GETHOSTBYNAME_R)
1774
check_symbol_exists("gethostname" "${CURL_INCLUDES}" HAVE_GETHOSTNAME) # winsock2.h unistd.h proto/bsdsocket.h
1775
1776
check_symbol_exists("signal" "signal.h" HAVE_SIGNAL)
1777
check_symbol_exists("strerror_r" "stdlib.h;string.h" HAVE_STRERROR_R)
1778
check_symbol_exists("sigaction" "signal.h" HAVE_SIGACTION)
1779
check_symbol_exists("siginterrupt" "signal.h" HAVE_SIGINTERRUPT)
1780
check_symbol_exists("getaddrinfo" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_GETADDRINFO) # ws2tcpip.h sys/socket.h netdb.h
1781
check_symbol_exists("getifaddrs" "${CURL_INCLUDES};stdlib.h" HAVE_GETIFADDRS) # ifaddrs.h
1782
check_symbol_exists("freeaddrinfo" "${CURL_INCLUDES}" HAVE_FREEADDRINFO) # ws2tcpip.h sys/socket.h netdb.h
1783
check_function_exists("pipe" HAVE_PIPE)
1784
check_function_exists("pipe2" HAVE_PIPE2)
1785
check_function_exists("eventfd" HAVE_EVENTFD)
1786
check_symbol_exists("ftruncate" "unistd.h" HAVE_FTRUNCATE)
1787
check_symbol_exists("getpeername" "${CURL_INCLUDES}" HAVE_GETPEERNAME) # winsock2.h unistd.h proto/bsdsocket.h
1788
check_symbol_exists("getsockname" "${CURL_INCLUDES}" HAVE_GETSOCKNAME) # winsock2.h unistd.h proto/bsdsocket.h
1789
check_function_exists("getrlimit" HAVE_GETRLIMIT)
1790
check_function_exists("setlocale" HAVE_SETLOCALE)
1791
check_function_exists("setrlimit" HAVE_SETRLIMIT)
1792
1793
if(WIN32)
1794
# include wincrypt.h as a workaround for mingw-w64 __MINGW64_VERSION_MAJOR <= 5 header bug */
1795
check_symbol_exists("if_nametoindex" "winsock2.h;wincrypt.h;iphlpapi.h" HAVE_IF_NAMETOINDEX) # Windows Vista+ non-UWP */
1796
else()
1797
check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # net/if.h
1798
check_function_exists("realpath" HAVE_REALPATH)
1799
check_function_exists("sched_yield" HAVE_SCHED_YIELD)
1800
check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP)
1801
check_symbol_exists("stricmp" "string.h" HAVE_STRICMP)
1802
check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI)
1803
endif()
1804
1805
if(NOT MINGW32CE) # Avoid false detections
1806
check_function_exists("setmode" HAVE_SETMODE)
1807
if(WIN32 OR CYGWIN)
1808
check_function_exists("_setmode" HAVE__SETMODE)
1809
endif()
1810
endif()
1811
1812
if(AMIGA)
1813
check_symbol_exists("CloseSocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET_CAMEL) # sys/socket.h proto/bsdsocket.h
1814
endif()
1815
1816
if(NOT _ssl_enabled)
1817
check_symbol_exists("arc4random" "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
1818
endif()
1819
1820
if(NOT MSVC)
1821
check_function_exists("snprintf" HAVE_SNPRINTF) # to match detection method in ./configure
1822
elseif(MSVC_VERSION GREATER_EQUAL 1900) # Earlier MSVC compilers had faulty snprintf implementations
1823
check_symbol_exists("snprintf" "stdio.h" HAVE_SNPRINTF) # snprintf may be a compatibility macro, not an exported function
1824
endif()
1825
if(APPLE)
1826
check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME)
1827
endif()
1828
if(NOT WIN32)
1829
check_symbol_exists("inet_ntop" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP) # arpa/inet.h netinet/in.h sys/socket.h
1830
check_symbol_exists("inet_pton" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON) # arpa/inet.h netinet/in.h sys/socket.h
1831
endif()
1832
1833
check_symbol_exists("fsetxattr" "sys/xattr.h" HAVE_FSETXATTR)
1834
if(HAVE_FSETXATTR)
1835
curl_internal_test(HAVE_FSETXATTR_5)
1836
curl_internal_test(HAVE_FSETXATTR_6)
1837
endif()
1838
1839
cmake_push_check_state()
1840
if(NOT WIN32)
1841
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
1842
check_type_size("sa_family_t" SIZEOF_SA_FAMILY_T)
1843
set(HAVE_SA_FAMILY_T ${HAVE_SIZEOF_SA_FAMILY_T})
1844
endif()
1845
cmake_pop_check_state()
1846
1847
# Do curl specific tests
1848
foreach(_curl_test IN ITEMS
1849
HAVE_FCNTL_O_NONBLOCK
1850
HAVE_IOCTLSOCKET
1851
HAVE_IOCTLSOCKET_CAMEL
1852
HAVE_IOCTLSOCKET_CAMEL_FIONBIO
1853
HAVE_IOCTLSOCKET_FIONBIO
1854
HAVE_IOCTL_FIONBIO
1855
HAVE_IOCTL_SIOCGIFADDR
1856
HAVE_SETSOCKOPT_SO_NONBLOCK
1857
HAVE_GETHOSTBYNAME_R_3
1858
HAVE_GETHOSTBYNAME_R_5
1859
HAVE_GETHOSTBYNAME_R_6
1860
HAVE_BOOL_T
1861
STDC_HEADERS
1862
HAVE_ATOMIC
1863
)
1864
curl_internal_test(${_curl_test})
1865
endforeach()
1866
1867
# Check for reentrant
1868
cmake_push_check_state()
1869
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_REENTRANT")
1870
foreach(_curl_test IN ITEMS
1871
HAVE_GETHOSTBYNAME_R_3
1872
HAVE_GETHOSTBYNAME_R_5
1873
HAVE_GETHOSTBYNAME_R_6)
1874
curl_internal_test(${_curl_test}_REENTRANT)
1875
if(NOT ${_curl_test} AND ${_curl_test}_REENTRANT)
1876
set(NEED_REENTRANT 1)
1877
endif()
1878
endforeach()
1879
cmake_pop_check_state()
1880
1881
if(NEED_REENTRANT)
1882
foreach(_curl_test IN ITEMS
1883
HAVE_GETHOSTBYNAME_R_3
1884
HAVE_GETHOSTBYNAME_R_5
1885
HAVE_GETHOSTBYNAME_R_6)
1886
set(${_curl_test} 0)
1887
if(${_curl_test}_REENTRANT)
1888
set(${_curl_test} 1)
1889
endif()
1890
endforeach()
1891
endif()
1892
1893
cmake_push_check_state()
1894
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
1895
curl_internal_test(HAVE_FILE_OFFSET_BITS)
1896
cmake_pop_check_state()
1897
1898
cmake_push_check_state()
1899
if(HAVE_FILE_OFFSET_BITS)
1900
set(_FILE_OFFSET_BITS 64)
1901
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
1902
endif()
1903
check_type_size("off_t" SIZEOF_OFF_T)
1904
1905
if(NOT WIN32)
1906
# fseeko may not exist with _FILE_OFFSET_BITS=64 but can exist with
1907
# _FILE_OFFSET_BITS unset or 32 (e.g. Android ARMv7 with NDK 26b and API level < 24)
1908
# so we need to test fseeko after testing for _FILE_OFFSET_BITS
1909
check_symbol_exists("fseeko" "${CURL_INCLUDES};stdio.h" HAVE_FSEEKO)
1910
1911
if(HAVE_FSEEKO)
1912
set(HAVE_DECL_FSEEKO 1)
1913
endif()
1914
endif()
1915
1916
# Include this header to get the type
1917
cmake_push_check_state()
1918
list(APPEND CMAKE_REQUIRED_INCLUDES "${PROJECT_SOURCE_DIR}/include")
1919
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "curl/system.h")
1920
check_type_size("curl_off_t" SIZEOF_CURL_OFF_T)
1921
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "curl/curl.h")
1922
check_type_size("curl_socket_t" SIZEOF_CURL_SOCKET_T)
1923
cmake_pop_check_state() # pop curl system headers
1924
cmake_pop_check_state() # pop -D_FILE_OFFSET_BITS=64
1925
1926
if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
1927
# On non-Windows and not cross-compiling, check for writable argv[]
1928
include(CheckCSourceRuns)
1929
check_c_source_runs("
1930
int main(int argc, char **argv)
1931
{
1932
(void)argc;
1933
argv[0][0] = ' ';
1934
return (argv[0][0] == ' ')?0:1;
1935
}" HAVE_WRITABLE_ARGV)
1936
endif()
1937
1938
if(NOT CMAKE_CROSSCOMPILING)
1939
include(CheckCSourceRuns)
1940
check_c_source_runs("
1941
#include <time.h>
1942
int main(void) {
1943
time_t t = -1;
1944
return t < 0;
1945
}" HAVE_TIME_T_UNSIGNED)
1946
endif()
1947
1948
curl_internal_test(HAVE_GLIBC_STRERROR_R)
1949
curl_internal_test(HAVE_POSIX_STRERROR_R)
1950
1951
if(NOT WIN32)
1952
curl_internal_test(HAVE_CLOCK_GETTIME_MONOTONIC) # Check clock_gettime(CLOCK_MONOTONIC, x) support
1953
endif()
1954
1955
if(APPLE)
1956
curl_internal_test(HAVE_BUILTIN_AVAILABLE) # Check compiler support of __builtin_available()
1957
endif()
1958
1959
# Some other minor tests
1960
1961
if(_cmake_try_compile_target_type_save)
1962
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_cmake_try_compile_target_type_save})
1963
unset(_cmake_try_compile_target_type_save)
1964
endif()
1965
1966
include(CMake/OtherTests.cmake)
1967
1968
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "HAVE_CONFIG_H")
1969
1970
if(WIN32)
1971
list(APPEND CURL_NETWORK_AND_TIME_LIBS "${_win32_winsock}")
1972
if(NOT WINCE AND NOT WINDOWS_STORE)
1973
list(APPEND CURL_NETWORK_AND_TIME_LIBS "iphlpapi")
1974
endif()
1975
if(NOT WINCE)
1976
list(APPEND CURL_LIBS "bcrypt")
1977
endif()
1978
1979
if(NOT WINCE)
1980
set(USE_WIN32_LARGE_FILES ON)
1981
endif()
1982
1983
# We use crypto functions that are not available for UWP apps
1984
if(NOT WINDOWS_STORE)
1985
set(USE_WIN32_CRYPTO ON)
1986
endif()
1987
1988
# Link required libraries for USE_WIN32_CRYPTO or USE_SCHANNEL
1989
if(USE_WIN32_CRYPTO OR USE_SCHANNEL)
1990
if(NOT WINCE)
1991
list(APPEND CURL_LIBS "advapi32")
1992
endif()
1993
list(APPEND CURL_LIBS "${_win32_crypt32}")
1994
endif()
1995
if(USE_WINDOWS_SSPI)
1996
list(APPEND CURL_LIBS "${_win32_secur32}")
1997
endif()
1998
endif()
1999
2000
list(APPEND CURL_LIBS ${CURL_NETWORK_AND_TIME_LIBS})
2001
if(CURL_CODE_COVERAGE)
2002
list(APPEND CURL_LIBS ${CURL_COVERAGE_LIBS})
2003
endif()
2004
2005
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") # MSVC but exclude clang-cl
2006
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-MP") # Parallel compilation
2007
endif()
2008
2009
if(CURL_LTO)
2010
if(CMAKE_VERSION VERSION_LESS 3.9)
2011
message(FATAL_ERROR "LTO has been requested, but your cmake version ${CMAKE_VERSION} is to old. You need at least 3.9")
2012
endif()
2013
2014
cmake_policy(SET CMP0069 NEW)
2015
2016
include(CheckIPOSupported)
2017
check_ipo_supported(RESULT CURL_HAS_LTO OUTPUT _lto_error LANGUAGES C)
2018
if(CURL_HAS_LTO)
2019
message(STATUS "LTO supported and enabled")
2020
else()
2021
message(FATAL_ERROR "LTO has been requested, but the compiler does not support it\n${_lto_error}")
2022
endif()
2023
endif()
2024
2025
2026
# Ugly (but functional) way to include "Makefile.inc" by transforming it
2027
# (= regenerate it).
2028
function(curl_transform_makefile_inc _input_file _output_file)
2029
file(READ ${_input_file} _makefile_inc_text)
2030
string(REPLACE "$(top_srcdir)" "\${PROJECT_SOURCE_DIR}" _makefile_inc_text ${_makefile_inc_text}) # cmake-lint: disable=W0106
2031
string(REPLACE "$(top_builddir)" "\${PROJECT_BINARY_DIR}" _makefile_inc_text ${_makefile_inc_text}) # cmake-lint: disable=W0106
2032
2033
string(REGEX REPLACE "\\\\\n" "!^!^!" _makefile_inc_text ${_makefile_inc_text})
2034
string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "set(\\1 \\2)" _makefile_inc_text ${_makefile_inc_text})
2035
string(REPLACE "!^!^!" "\n" _makefile_inc_text ${_makefile_inc_text})
2036
2037
# Replace $() with ${}
2038
string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" _makefile_inc_text ${_makefile_inc_text})
2039
# Replace @@ with ${}, even if that may not be read by CMake scripts.
2040
string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" _makefile_inc_text ${_makefile_inc_text})
2041
2042
file(WRITE ${_output_file} ${_makefile_inc_text})
2043
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${_input_file}")
2044
endfunction()
2045
2046
include(GNUInstallDirs)
2047
2048
set(_install_cmake_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
2049
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
2050
set(_generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
2051
set(_project_config "${_generated_dir}/${PROJECT_NAME}Config.cmake")
2052
set(_version_config "${_generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
2053
2054
option(BUILD_TESTING "Build tests" ON)
2055
if(BUILD_TESTING AND PERL_FOUND)
2056
set(CURL_BUILD_TESTING ON)
2057
else()
2058
set(CURL_BUILD_TESTING OFF)
2059
endif()
2060
2061
if(PERL_FOUND)
2062
set(CURL_MANPAGE "${PROJECT_BINARY_DIR}/docs/cmdline-opts/curl.1")
2063
set(CURL_ASCIIPAGE "${PROJECT_BINARY_DIR}/docs/cmdline-opts/curl.txt")
2064
add_subdirectory(docs)
2065
endif()
2066
2067
add_subdirectory(scripts) # for shell completions
2068
2069
list(REMOVE_DUPLICATES CURL_LIBDIRS)
2070
2071
add_subdirectory(lib)
2072
2073
if(BUILD_CURL_EXE)
2074
add_subdirectory(src)
2075
endif()
2076
2077
option(BUILD_EXAMPLES "Build libcurl examples" ON)
2078
if(BUILD_EXAMPLES)
2079
add_subdirectory(docs/examples)
2080
endif()
2081
2082
if(CURL_BUILD_TESTING)
2083
add_subdirectory(tests)
2084
endif()
2085
2086
# Helper to populate a list (_items) with a label when conditions
2087
# (the remaining args) are satisfied
2088
macro(curl_add_if _label)
2089
# Needs to be a macro to allow this indirection
2090
if(${ARGN})
2091
set(_items ${_items} "${_label}")
2092
endif()
2093
endmacro()
2094
2095
# NTLM support requires crypto functions from various SSL libs.
2096
# These conditions must match those in lib/curl_setup.h.
2097
if(NOT CURL_DISABLE_NTLM AND
2098
((USE_OPENSSL AND HAVE_DES_ECB_ENCRYPT) OR
2099
(USE_MBEDTLS AND HAVE_MBEDTLS_DES_CRYPT_ECB) OR
2100
USE_GNUTLS OR
2101
USE_WIN32_CRYPTO OR
2102
(USE_WOLFSSL AND HAVE_WOLFSSL_DES_ECB_ENCRYPT)))
2103
set(_use_curl_ntlm_core ON)
2104
endif()
2105
2106
# Clear list and try to detect available protocols
2107
set(_items "")
2108
curl_add_if("HTTP" NOT CURL_DISABLE_HTTP)
2109
curl_add_if("HTTPS" NOT CURL_DISABLE_HTTP AND _ssl_enabled)
2110
curl_add_if("FTP" NOT CURL_DISABLE_FTP)
2111
curl_add_if("FTPS" NOT CURL_DISABLE_FTP AND _ssl_enabled)
2112
curl_add_if("FILE" NOT CURL_DISABLE_FILE)
2113
curl_add_if("TELNET" NOT CURL_DISABLE_TELNET)
2114
curl_add_if("LDAP" NOT CURL_DISABLE_LDAP)
2115
# CURL_DISABLE_LDAP implies CURL_DISABLE_LDAPS
2116
curl_add_if("LDAPS" NOT CURL_DISABLE_LDAPS AND
2117
((USE_OPENLDAP AND _ssl_enabled) OR
2118
(NOT USE_OPENLDAP AND HAVE_LDAP_SSL)))
2119
curl_add_if("DICT" NOT CURL_DISABLE_DICT)
2120
curl_add_if("TFTP" NOT CURL_DISABLE_TFTP)
2121
curl_add_if("GOPHER" NOT CURL_DISABLE_GOPHER)
2122
curl_add_if("GOPHERS" NOT CURL_DISABLE_GOPHER AND _ssl_enabled)
2123
curl_add_if("POP3" NOT CURL_DISABLE_POP3)
2124
curl_add_if("POP3S" NOT CURL_DISABLE_POP3 AND _ssl_enabled)
2125
curl_add_if("IMAP" NOT CURL_DISABLE_IMAP)
2126
curl_add_if("IMAPS" NOT CURL_DISABLE_IMAP AND _ssl_enabled)
2127
curl_add_if("SMB" NOT CURL_DISABLE_SMB AND
2128
_use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4))
2129
curl_add_if("SMBS" NOT CURL_DISABLE_SMB AND _ssl_enabled AND
2130
_use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4))
2131
curl_add_if("SMTP" NOT CURL_DISABLE_SMTP)
2132
curl_add_if("SMTPS" NOT CURL_DISABLE_SMTP AND _ssl_enabled)
2133
curl_add_if("SCP" USE_LIBSSH2 OR USE_LIBSSH)
2134
curl_add_if("SFTP" USE_LIBSSH2 OR USE_LIBSSH)
2135
curl_add_if("IPFS" NOT CURL_DISABLE_IPFS)
2136
curl_add_if("IPNS" NOT CURL_DISABLE_IPFS)
2137
curl_add_if("RTSP" NOT CURL_DISABLE_RTSP)
2138
curl_add_if("RTMP" USE_LIBRTMP)
2139
curl_add_if("MQTT" NOT CURL_DISABLE_MQTT)
2140
curl_add_if("WS" NOT CURL_DISABLE_WEBSOCKETS)
2141
curl_add_if("WSS" NOT CURL_DISABLE_WEBSOCKETS AND _ssl_enabled)
2142
if(_items)
2143
list(SORT _items)
2144
endif()
2145
set(CURL_SUPPORTED_PROTOCOLS_LIST "${_items}")
2146
string(REPLACE ";" " " SUPPORT_PROTOCOLS "${_items}")
2147
string(TOLOWER "${SUPPORT_PROTOCOLS}" _support_protocols_lower)
2148
message(STATUS "Protocols: ${_support_protocols_lower}")
2149
2150
# Clear list and try to detect available features
2151
set(_items "")
2152
curl_add_if("SSL" _ssl_enabled)
2153
curl_add_if("IPv6" USE_IPV6)
2154
curl_add_if("UnixSockets" USE_UNIX_SOCKETS)
2155
curl_add_if("libz" HAVE_LIBZ)
2156
curl_add_if("brotli" HAVE_BROTLI)
2157
curl_add_if("gsasl" USE_GSASL)
2158
curl_add_if("zstd" HAVE_ZSTD)
2159
curl_add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32)
2160
curl_add_if("asyn-rr" USE_ARES AND ENABLE_THREADED_RESOLVER AND USE_HTTPSRR)
2161
curl_add_if("IDN" (HAVE_LIBIDN2 AND HAVE_IDN2_H) OR
2162
USE_WIN32_IDN OR
2163
USE_APPLE_IDN)
2164
curl_add_if("Largefile" (SIZEOF_CURL_OFF_T GREATER 4) AND
2165
((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES))
2166
curl_add_if("SSPI" USE_WINDOWS_SSPI)
2167
curl_add_if("GSS-API" HAVE_GSSAPI)
2168
curl_add_if("alt-svc" NOT CURL_DISABLE_ALTSVC)
2169
curl_add_if("HSTS" NOT CURL_DISABLE_HSTS)
2170
curl_add_if("SPNEGO" NOT CURL_DISABLE_NEGOTIATE_AUTH AND
2171
(HAVE_GSSAPI OR USE_WINDOWS_SSPI))
2172
curl_add_if("Kerberos" NOT CURL_DISABLE_KERBEROS_AUTH AND
2173
(HAVE_GSSAPI OR USE_WINDOWS_SSPI))
2174
curl_add_if("NTLM" NOT CURL_DISABLE_NTLM AND
2175
(_use_curl_ntlm_core OR USE_WINDOWS_SSPI))
2176
curl_add_if("TLS-SRP" USE_TLS_SRP)
2177
curl_add_if("HTTP2" USE_NGHTTP2)
2178
curl_add_if("HTTP3" USE_NGTCP2 OR USE_QUICHE OR USE_OPENSSL_QUIC)
2179
curl_add_if("MultiSSL" CURL_WITH_MULTI_SSL)
2180
curl_add_if("HTTPS-proxy" NOT CURL_DISABLE_PROXY AND _ssl_enabled AND (USE_OPENSSL OR USE_GNUTLS
2181
OR USE_SCHANNEL OR USE_RUSTLS OR USE_MBEDTLS OR
2182
(USE_WOLFSSL AND HAVE_WOLFSSL_BIO_NEW)))
2183
curl_add_if("Unicode" ENABLE_UNICODE)
2184
curl_add_if("threadsafe" HAVE_ATOMIC OR
2185
(USE_THREADS_POSIX AND HAVE_PTHREAD_H) OR
2186
(WIN32 AND HAVE_WIN32_WINNT GREATER_EQUAL 0x0600))
2187
curl_add_if("Debug" ENABLE_DEBUG)
2188
curl_add_if("TrackMemory" ENABLE_CURLDEBUG)
2189
curl_add_if("ECH" _ssl_enabled AND HAVE_ECH)
2190
curl_add_if("HTTPSRR" _ssl_enabled AND USE_HTTPSRR)
2191
curl_add_if("PSL" USE_LIBPSL)
2192
curl_add_if("CAcert" CURL_CA_EMBED_SET)
2193
curl_add_if("SSLS-EXPORT" _ssl_enabled AND USE_SSLS_EXPORT)
2194
curl_add_if("AppleSecTrust" USE_APPLE_SECTRUST AND _ssl_enabled AND (USE_OPENSSL OR USE_GNUTLS))
2195
if(_items)
2196
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
2197
list(SORT _items CASE INSENSITIVE)
2198
else()
2199
list(SORT _items)
2200
endif()
2201
endif()
2202
set(CURL_SUPPORTED_FEATURES_LIST "${_items}")
2203
string(REPLACE ";" " " SUPPORT_FEATURES "${_items}")
2204
message(STATUS "Features: ${SUPPORT_FEATURES}")
2205
2206
# Clear list and collect SSL backends
2207
set(_items "")
2208
curl_add_if("Schannel" _ssl_enabled AND USE_SCHANNEL)
2209
curl_add_if("${_openssl}" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_LESS 3.0.0)
2210
curl_add_if("${_openssl} v3+" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_GREATER_EQUAL 3.0.0)
2211
curl_add_if("mbedTLS" _ssl_enabled AND USE_MBEDTLS)
2212
curl_add_if("wolfSSL" _ssl_enabled AND USE_WOLFSSL)
2213
curl_add_if("GnuTLS" _ssl_enabled AND USE_GNUTLS)
2214
curl_add_if("Rustls" _ssl_enabled AND USE_RUSTLS)
2215
2216
if(_items)
2217
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
2218
list(SORT _items CASE INSENSITIVE)
2219
else()
2220
list(SORT _items)
2221
endif()
2222
endif()
2223
string(REPLACE ";" " " SSL_BACKENDS "${_items}")
2224
message(STATUS "Enabled SSL backends: ${SSL_BACKENDS}")
2225
if(CURL_DEFAULT_SSL_BACKEND)
2226
message(STATUS "Default SSL backend: ${CURL_DEFAULT_SSL_BACKEND}")
2227
endif()
2228
2229
if(NOT CURL_DISABLE_INSTALL)
2230
2231
# curl-config needs the following options to be set.
2232
set(CC "${CMAKE_C_COMPILER}")
2233
set(CONFIGURE_OPTIONS "")
2234
set(CURLVERSION "${_curl_version}")
2235
set(VERSIONNUM "${_curl_version_num}")
2236
set(prefix "${CMAKE_INSTALL_PREFIX}")
2237
set(exec_prefix "\${prefix}")
2238
if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR})
2239
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
2240
else()
2241
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
2242
endif()
2243
if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
2244
set(libdir "${CMAKE_INSTALL_LIBDIR}")
2245
else()
2246
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
2247
endif()
2248
# "a" (Linux) or "lib" (Windows)
2249
string(REPLACE "." "" libext "${CMAKE_STATIC_LIBRARY_SUFFIX}")
2250
2251
set(_ldflags "")
2252
set(LIBCURL_PC_LIBS_PRIVATE "")
2253
2254
# Filter CMAKE_SHARED_LINKER_FLAGS for libs and libpaths
2255
string(STRIP "${CMAKE_SHARED_LINKER_FLAGS}" _custom_ldflags)
2256
string(REGEX REPLACE " +-([^ \\t;]*)" ";-\\1" _custom_ldflags "${_custom_ldflags}")
2257
2258
set(_custom_libs "")
2259
set(_custom_libdirs "")
2260
foreach(_flag IN LISTS _custom_ldflags)
2261
if(_flag MATCHES "^-l")
2262
string(REGEX REPLACE "^-l" "" _flag "${_flag}")
2263
list(APPEND _custom_libs "${_flag}")
2264
elseif(_flag MATCHES "^-framework|^-F")
2265
list(APPEND _custom_libs "${_flag}")
2266
elseif(_flag MATCHES "^-L")
2267
string(REGEX REPLACE "^-L" "" _flag "${_flag}")
2268
list(APPEND _custom_libdirs "${_flag}")
2269
elseif(_flag MATCHES "^--library-path=")
2270
string(REGEX REPLACE "^--library-path=" "" _flag "${_flag}")
2271
list(APPEND _custom_libdirs "${_flag}")
2272
endif()
2273
endforeach()
2274
2275
# Avoid getting unnecessary -L options for known system directories.
2276
set(_sys_libdirs "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
2277
foreach(_libdir IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
2278
if(_libdir MATCHES "/$")
2279
string(APPEND _libdir "lib")
2280
else()
2281
string(APPEND _libdir "/lib")
2282
endif()
2283
if(IS_DIRECTORY "${_libdir}")
2284
list(APPEND _sys_libdirs "${_libdir}")
2285
endif()
2286
if(DEFINED CMAKE_LIBRARY_ARCHITECTURE)
2287
string(APPEND _libdir "/${CMAKE_LIBRARY_ARCHITECTURE}")
2288
if(IS_DIRECTORY "${_libdir}")
2289
list(APPEND _sys_libdirs "${_libdir}")
2290
endif()
2291
endif()
2292
endforeach()
2293
2294
foreach(_libdir IN LISTS _custom_libdirs CURL_LIBDIRS)
2295
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
2296
cmake_path(SET _libdir NORMALIZE "${_libdir}")
2297
endif()
2298
list(FIND _sys_libdirs "${_libdir}" _libdir_index)
2299
if(_libdir_index LESS 0)
2300
list(APPEND _ldflags "-L${_libdir}")
2301
endif()
2302
endforeach()
2303
2304
set(_implicit_libs "")
2305
if(NOT MINGW AND NOT UNIX)
2306
set(_implicit_libs "${CMAKE_C_IMPLICIT_LINK_LIBRARIES}")
2307
endif()
2308
2309
foreach(_lib IN LISTS _implicit_libs _custom_libs CURL_LIBS)
2310
if(TARGET "${_lib}")
2311
set(_libname "${_lib}")
2312
get_target_property(_imported "${_libname}" IMPORTED)
2313
if(NOT _imported)
2314
# Reading the LOCATION property on non-imported target will error out.
2315
# Assume the user will not need this information in the .pc file.
2316
continue()
2317
endif()
2318
get_target_property(_lib "${_libname}" LOCATION)
2319
if(NOT _lib)
2320
message(WARNING "Bad lib in library list: ${_libname}")
2321
continue()
2322
endif()
2323
endif()
2324
if(_lib MATCHES "^-") # '-framework <name>'
2325
list(APPEND _ldflags "${_lib}")
2326
elseif(_lib MATCHES "/")
2327
# This gets a bit more complex, because we want to specify the
2328
# directory separately, and only once per directory
2329
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
2330
cmake_path(GET _lib PARENT_PATH _libdir)
2331
cmake_path(GET _lib STEM _libname)
2332
else()
2333
get_filename_component(_libdir "${_lib}" DIRECTORY)
2334
get_filename_component(_libname "${_lib}" NAME_WE)
2335
endif()
2336
if(_libname MATCHES "^lib")
2337
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
2338
cmake_path(SET _libdir NORMALIZE "${_libdir}")
2339
endif()
2340
list(FIND _sys_libdirs "${_libdir}" _libdir_index)
2341
if(_libdir_index LESS 0)
2342
list(APPEND _ldflags "-L${_libdir}")
2343
endif()
2344
string(REGEX REPLACE "^lib" "" _libname "${_libname}")
2345
list(APPEND LIBCURL_PC_LIBS_PRIVATE "-l${_libname}")
2346
else()
2347
list(APPEND LIBCURL_PC_LIBS_PRIVATE "${_lib}")
2348
endif()
2349
else()
2350
list(APPEND LIBCURL_PC_LIBS_PRIVATE "-l${_lib}")
2351
endif()
2352
endforeach()
2353
2354
if(LIBCURL_PC_REQUIRES_PRIVATE)
2355
string(REPLACE ";" "," LIBCURL_PC_REQUIRES_PRIVATE "${LIBCURL_PC_REQUIRES_PRIVATE}")
2356
endif()
2357
if(LIBCURL_PC_LIBS_PRIVATE)
2358
string(REPLACE ";" " " LIBCURL_PC_LIBS_PRIVATE "${LIBCURL_PC_LIBS_PRIVATE}")
2359
endif()
2360
if(_ldflags)
2361
list(REMOVE_DUPLICATES _ldflags)
2362
string(REPLACE ";" " " _ldflags "${_ldflags}")
2363
set(LIBCURL_PC_LDFLAGS_PRIVATE "${_ldflags}")
2364
string(STRIP "${LIBCURL_PC_LDFLAGS_PRIVATE}" LIBCURL_PC_LDFLAGS_PRIVATE)
2365
else()
2366
set(LIBCURL_PC_LDFLAGS_PRIVATE "")
2367
endif()
2368
set(LIBCURL_PC_CFLAGS_PRIVATE "-DCURL_STATICLIB")
2369
2370
# Merge pkg-config private fields into public ones when static-only
2371
if(BUILD_SHARED_LIBS)
2372
set(ENABLE_SHARED "yes")
2373
set(LIBCURL_PC_REQUIRES "")
2374
set(LIBCURL_PC_LIBS "")
2375
set(LIBCURL_PC_CFLAGS "")
2376
else()
2377
set(ENABLE_SHARED "no")
2378
set(LIBCURL_PC_REQUIRES "${LIBCURL_PC_REQUIRES_PRIVATE}")
2379
set(LIBCURL_PC_LIBS "${LIBCURL_PC_LIBS_PRIVATE}")
2380
set(LIBCURL_PC_CFLAGS "${LIBCURL_PC_CFLAGS_PRIVATE}")
2381
endif()
2382
if(BUILD_STATIC_LIBS)
2383
set(ENABLE_STATIC "yes")
2384
else()
2385
set(ENABLE_STATIC "no")
2386
endif()
2387
2388
# Generate a "curl-config" matching this config.
2389
# Consumed variables:
2390
# CC
2391
# CONFIGURE_OPTIONS
2392
# CURLVERSION
2393
# CURL_CA_BUNDLE
2394
# ENABLE_SHARED
2395
# ENABLE_STATIC
2396
# exec_prefix
2397
# includedir
2398
# LIBCURL_PC_CFLAGS
2399
# LIBCURL_PC_LDFLAGS_PRIVATE
2400
# LIBCURL_PC_LIBS_PRIVATE
2401
# libdir
2402
# libext
2403
# prefix
2404
# SSL_BACKENDS
2405
# SUPPORT_FEATURES
2406
# SUPPORT_PROTOCOLS
2407
# VERSIONNUM
2408
configure_file(
2409
"${PROJECT_SOURCE_DIR}/curl-config.in"
2410
"${PROJECT_BINARY_DIR}/curl-config" @ONLY)
2411
install(FILES "${PROJECT_BINARY_DIR}/curl-config"
2412
DESTINATION ${CMAKE_INSTALL_BINDIR}
2413
PERMISSIONS
2414
OWNER_READ OWNER_WRITE OWNER_EXECUTE
2415
GROUP_READ GROUP_EXECUTE
2416
WORLD_READ WORLD_EXECUTE)
2417
2418
# Generate a pkg-config file matching this config.
2419
# Consumed variables:
2420
# CURLVERSION
2421
# exec_prefix
2422
# includedir
2423
# LIBCURL_PC_CFLAGS
2424
# LIBCURL_PC_CFLAGS_PRIVATE
2425
# LIBCURL_PC_LDFLAGS_PRIVATE
2426
# LIBCURL_PC_LIBS
2427
# LIBCURL_PC_LIBS_PRIVATE
2428
# LIBCURL_PC_REQUIRES
2429
# LIBCURL_PC_REQUIRES_PRIVATE
2430
# libdir
2431
# prefix
2432
# SUPPORT_FEATURES
2433
# SUPPORT_PROTOCOLS
2434
# Documentation:
2435
# https://people.freedesktop.org/~dbn/pkg-config-guide.html
2436
# https://manpages.debian.org/unstable/pkgconf/pkg-config.1.en.html
2437
# https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html
2438
# https://www.msys2.org/docs/pkgconfig/
2439
configure_file(
2440
"${PROJECT_SOURCE_DIR}/libcurl.pc.in"
2441
"${PROJECT_BINARY_DIR}/libcurl.pc" @ONLY)
2442
install(FILES "${PROJECT_BINARY_DIR}/libcurl.pc"
2443
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
2444
2445
# Install headers
2446
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/curl"
2447
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
2448
FILES_MATCHING PATTERN "*.h")
2449
2450
include(CMakePackageConfigHelpers)
2451
write_basic_package_version_file(
2452
"${_version_config}"
2453
VERSION ${_curl_version}
2454
COMPATIBILITY SameMajorVersion)
2455
file(READ "${_version_config}" _generated_version_config)
2456
file(WRITE "${_version_config}" "
2457
if(NOT PACKAGE_FIND_VERSION_RANGE AND PACKAGE_FIND_VERSION_MAJOR STREQUAL \"7\")
2458
# Version 8 satisfies version 7... requirements
2459
set(PACKAGE_FIND_VERSION_MAJOR 8)
2460
set(PACKAGE_FIND_VERSION_COUNT 1)
2461
endif()
2462
${_generated_version_config}")
2463
2464
# Consumed custom variables:
2465
# CURLVERSION
2466
# LIB_NAME
2467
# LIB_SELECTED
2468
# TARGETS_EXPORT_NAME
2469
# USE_OPENSSL OPENSSL_VERSION_MAJOR
2470
# HAVE_LIBZ ZLIB_VERSION_MAJOR
2471
# CURL_SUPPORTED_FEATURES_LIST
2472
# CURL_SUPPORTED_PROTOCOLS_LIST
2473
configure_package_config_file("CMake/curl-config.cmake.in"
2474
"${_project_config}"
2475
INSTALL_DESTINATION ${_install_cmake_dir}
2476
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
2477
2478
if(CURL_ENABLE_EXPORT_TARGET)
2479
install(EXPORT "${TARGETS_EXPORT_NAME}"
2480
NAMESPACE "${PROJECT_NAME}::"
2481
DESTINATION ${_install_cmake_dir})
2482
endif()
2483
2484
install(FILES ${_version_config} ${_project_config}
2485
DESTINATION ${_install_cmake_dir})
2486
2487
if(NOT TARGET curl_uninstall)
2488
configure_file(
2489
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in"
2490
"${CMAKE_CURRENT_BINARY_DIR}/CMake/cmake_uninstall.cmake"
2491
@ONLY)
2492
2493
add_custom_target(curl_uninstall
2494
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/CMake/cmake_uninstall.cmake")
2495
endif()
2496
2497
install(FILES "${PROJECT_SOURCE_DIR}/scripts/wcurl"
2498
DESTINATION ${CMAKE_INSTALL_BINDIR}
2499
PERMISSIONS
2500
OWNER_READ OWNER_WRITE OWNER_EXECUTE
2501
GROUP_READ GROUP_EXECUTE
2502
WORLD_READ WORLD_EXECUTE)
2503
2504
# The `-DEV` part is important
2505
string(REGEX REPLACE "([0-9]+\.[0-9]+)\.([0-9]+.*)" "\\2" CPACK_PACKAGE_VERSION_PATCH "${_curl_version}")
2506
set(CPACK_GENERATOR "TGZ")
2507
include(CPack)
2508
endif()
2509
2510
# Save build info for test runner to pick up and log
2511
set(_cmake_sysroot "")
2512
if(CMAKE_OSX_SYSROOT)
2513
set(_cmake_sysroot ${CMAKE_OSX_SYSROOT})
2514
elseif(CMAKE_SYSROOT)
2515
set(_cmake_sysroot ${CMAKE_SYSROOT})
2516
endif()
2517
set(_buildinfo "\
2518
buildinfo.configure.tool: cmake
2519
buildinfo.configure.command: ${CMAKE_COMMAND}
2520
buildinfo.configure.version: ${CMAKE_VERSION}
2521
buildinfo.configure.args:${_cmake_args}
2522
buildinfo.configure.generator: ${CMAKE_GENERATOR}
2523
buildinfo.configure.make: ${CMAKE_MAKE_PROGRAM}
2524
buildinfo.host.cpu: ${CMAKE_HOST_SYSTEM_PROCESSOR}
2525
buildinfo.host.os: ${CMAKE_HOST_SYSTEM_NAME}
2526
buildinfo.target.cpu: ${CMAKE_SYSTEM_PROCESSOR}
2527
buildinfo.target.os: ${CMAKE_SYSTEM_NAME}
2528
buildinfo.target.flags:${_target_flags}
2529
buildinfo.compiler: ${CMAKE_C_COMPILER_ID}
2530
buildinfo.compiler.version: ${CMAKE_C_COMPILER_VERSION}
2531
buildinfo.sysroot: ${_cmake_sysroot}
2532
")
2533
file(WRITE "${PROJECT_BINARY_DIR}/buildinfo.txt" "# This is a generated file. Do not edit.\n${_buildinfo}")
2534
if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
2535
message(STATUS "\n${_buildinfo}")
2536
endif()
2537
2538