-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathCMakeLists.txt
107 lines (95 loc) · 3.61 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
find_package(CURL CONFIG)
if(CURL_FOUND)
set(CURL_VERSION_STRING ${CURL_VERSION})
else()
find_package(CURL REQUIRED)
endif()
endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
if((NS_CURL_ASSUME_FEATURES_MISSING) OR (CURL_VERSION_STRING VERSION_LESS "7.32.0"))
add_compile_definitions(NS_CURL_MISSING_XFERINFOFUNCTION)
endif()
if((NS_CURL_ASSUME_FEATURES_MISSING) OR (CURL_VERSION_STRING VERSION_LESS "7.30.0"))
add_compile_definitions(NS_CURL_MISSING_MAX_HOST_CONNECTIONS)
endif()
if((NS_CURL_ASSUME_FEATURES_MISSING) OR (CURL_VERSION_STRING VERSION_LESS "7.71.0"))
add_compile_definitions(NS_CURL_MISSING_CURLINFO_SSLCERT_BLOB NS_CURL_MISSING_CURLINFO_SSLKEY_BLOB)
endif()
if((NS_CURL_ASSUME_FEATURES_MISSING) OR (CURL_VERSION_STRING VERSION_LESS "7.84.0"))
add_compile_definitions(NS_CURL_MISSING_CURLINFO_CAINFO)
endif()
endif()
add_library(FoundationNetworking
../Foundation/Boxing.swift
DataURLProtocol.swift
HTTPCookie.swift
HTTPCookieStorage.swift
NSURLRequest.swift
URLAuthenticationChallenge.swift
URLCache.swift
URLCredential.swift
URLCredentialStorage.swift
URLProtectionSpace.swift
URLProtocol.swift
URLRequest.swift
URLResponse.swift
URLSession/BodySource.swift
URLSession/Configuration.swift
URLSession/FTP/FTPURLProtocol.swift
URLSession/HTTP/HTTPMessage.swift
URLSession/HTTP/HTTPURLProtocol.swift
URLSession/WebSocket/WebSocketURLProtocol.swift
URLSession/Message.swift
URLSession/NativeProtocol.swift
URLSession/NetworkingSpecific.swift
URLSession/TaskRegistry.swift
URLSession/TransferState.swift
URLSession/URLSession.swift
URLSession/URLSessionConfiguration.swift
URLSession/URLSessionDelegate.swift
URLSession/URLSessionTask.swift
URLSession/URLSessionTaskMetrics.swift
URLSession/libcurl/EasyHandle.swift
URLSession/libcurl/MultiHandle.swift
URLSession/libcurl/libcurlHelpers.swift)
target_compile_definitions(FoundationNetworking PRIVATE
DEPLOYMENT_RUNTIME_SWIFT
NS_BUILDING_FOUNDATION_NETWORKING)
target_compile_options(FoundationNetworking PUBLIC
-autolink-force-load
# SR-12254: workaround for the swift compiler not properly tracking the
# forced load symbol when validating the TBD
-Xfrontend -validate-tbd-against-ir=none
$<$<BOOL:${ENABLE_TESTING}>:-enable-testing>
"SHELL:-Xfrontend -disable-autolink-framework -Xfrontend CFURLSessionInterface"
"SHELL:-Xcc -F${CMAKE_BINARY_DIR}")
target_link_libraries(FoundationNetworking
PRIVATE
CFURLSessionInterface
PUBLIC
Foundation)
if(NOT BUILD_SHARED_LIBS)
target_compile_options(FoundationNetworking
PRIVATE
"SHELL:-Xfrontend -public-autolink-library -Xfrontend curl")
if(BUILD_FULLY_STATIC)
target_compile_options(FoundationNetworking
PRIVATE
"SHELL:-Xfrontend -public-autolink-library -Xfrontend crypto"
"SHELL:-Xfrontend -public-autolink-library -Xfrontend ssl"
"SHELL:-Xfrontend -public-autolink-library -Xfrontend z")
endif()
# Merge private dependencies into single static objects archive
set_property(TARGET FoundationNetworking PROPERTY STATIC_LIBRARY_OPTIONS
$<TARGET_OBJECTS:CFURLSessionInterface>)
endif()
set_target_properties(FoundationNetworking PROPERTIES
INSTALL_RPATH "$ORIGIN"
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift)
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
target_link_options(FoundationNetworking PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
endif()
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationNetworking)
_install_target(FoundationNetworking)