Make loading system certificates from the Keychain on macOS an opt-out feature (#2377)

This commit is contained in:
yhirose
2026-02-22 19:18:40 -05:00
committed by GitHub
parent 7c33fd47bf
commit c2002f6e06
6 changed files with 54 additions and 36 deletions

View File

@@ -62,11 +62,13 @@ if get_option('tls').allowed()
endif
if tls_found and host_machine.system() == 'darwin'
macosx_keychain_dep = dependency('appleframeworks', modules: ['CFNetwork', 'CoreFoundation', 'Security'], required: get_option('macosx_keychain'))
if macosx_keychain_dep.found()
disable_macosx_certs = get_option('disable_macosx_automatic_root_certificates')
if disable_macosx_certs
args += '-DCPPHTTPLIB_DISABLE_MACOSX_AUTOMATIC_ROOT_CERTIFICATES'
else
macosx_keychain_dep = dependency('appleframeworks', modules: ['CFNetwork', 'CoreFoundation', 'Security'], required: true)
deps += macosx_keychain_dep
args += '-DCPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN'
endif
endif
endif
endif