6
6
* HTTPLIB_REQUIRE_OPENSSL (default off)
7
7
* HTTPLIB_REQUIRE_ZLIB (default off)
8
8
* HTTPLIB_USE_BROTLI_IF_AVAILABLE (default on)
9
+ * HTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN (default on)
9
10
* HTTPLIB_REQUIRE_BROTLI (default off)
10
11
* HTTPLIB_COMPILE (default off)
11
12
* HTTPLIB_TEST (default off)
43
44
* HTTPLIB_IS_USING_OPENSSL - a bool for if OpenSSL support is enabled.
44
45
* HTTPLIB_IS_USING_ZLIB - a bool for if ZLIB support is enabled.
45
46
* HTTPLIB_IS_USING_BROTLI - a bool for if Brotli support is enabled.
47
+ * HTTPLIB_IS_USING_CERTS_FROM_MACOSX_KEYCHAIN - a bool for if support of loading system certs from the Apple Keychain is enabled.
46
48
* HTTPLIB_IS_COMPILED - a bool for if the library is compiled, or otherwise header-only.
47
49
* HTTPLIB_INCLUDE_DIR - the root path to httplib's header (e.g. /usr/include).
48
50
* HTTPLIB_LIBRARY - the full path to the library if compiled (e.g. /usr/lib/libhttplib.so).
@@ -92,6 +94,7 @@ endif()
92
94
option (HTTPLIB_TEST "Enables testing and builds tests" OFF )
93
95
option (HTTPLIB_REQUIRE_BROTLI "Requires Brotli to be found & linked, or fails build." OFF )
94
96
option (HTTPLIB_USE_BROTLI_IF_AVAILABLE "Uses Brotli (if available) to enable Brotli decompression support." ON )
97
+ option (HTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN "Enable feature to load system certs from the Apple Keychain." ON )
95
98
# Defaults to static library
96
99
option (BUILD_SHARED_LIBS "Build the library as a shared library instead of static. Has no effect if using header-only." OFF )
97
100
if (BUILD_SHARED_LIBS AND WIN32 AND HTTPLIB_COMPILE)
@@ -137,6 +140,10 @@ if(Brotli_FOUND)
137
140
set (HTTPLIB_IS_USING_BROTLI TRUE )
138
141
endif ()
139
142
143
+ if (HTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
144
+ set (HTTPLIB_IS_USING_CERTS_FROM_MACOSX_KEYCHAIN TRUE )
145
+ endif ()
146
+
140
147
# Used for default, common dirs that the end-user can change (if needed)
141
148
# like CMAKE_INSTALL_INCLUDEDIR or CMAKE_INSTALL_DATADIR
142
149
include (GNUInstallDirs)
@@ -207,7 +214,7 @@ target_link_libraries(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
207
214
$<$<PLATFORM_ID:Windows>:crypt32>
208
215
$<$<PLATFORM_ID:Windows>:cryptui>
209
216
# Needed for API from MacOS Security framework
210
- "$<$<AND:$<PLATFORM_ID:Darwin>,$<BOOL:${HTTPLIB_IS_USING_OPENSSL} >>:-framework CoreFoundation -framework Security>"
217
+ "$<$<AND:$<PLATFORM_ID:Darwin>,$<BOOL:${HTTPLIB_IS_USING_OPENSSL} >, $<BOOL: ${HTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN} > >:-framework CoreFoundation -framework Security>"
211
218
# Can't put multiple targets in a single generator expression or it bugs out.
212
219
$<$<BOOL :${HTTPLIB_IS_USING_BROTLI} >:Brotli::common>
213
220
$<$<BOOL :${HTTPLIB_IS_USING_BROTLI} >:Brotli::encoder>
@@ -222,6 +229,7 @@ target_compile_definitions(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
222
229
$<$<BOOL :${HTTPLIB_IS_USING_BROTLI} >:CPPHTTPLIB_BROTLI_SUPPORT>
223
230
$<$<BOOL :${HTTPLIB_IS_USING_ZLIB} >:CPPHTTPLIB_ZLIB_SUPPORT>
224
231
$<$<BOOL :${HTTPLIB_IS_USING_OPENSSL} >:CPPHTTPLIB_OPENSSL_SUPPORT>
232
+ $<$<AND :$<PLATFORM_ID:Darwin>,$<BOOL :${HTTPLIB_IS_USING_OPENSSL} >, $<BOOL :${HTTPLIB_IS_USING_CERTS_FROM_MACOSX_KEYCHAIN} >>:CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN>
225
233
)
226
234
227
235
# CMake configuration files installation directory
0 commit comments