Skip to content

Commit 6ab7e19

Browse files
ryandesignbagder
authored andcommitted
cmake, configure: also link with CoreServices
When linking with CoreFoundation, also link with CoreServices which is apparently required to avoid an NSInvalidArgumentException in software linking with libcurl on macOS Sonoma 14 and later. Fixes #11893 Closes #11894
1 parent c6dc25f commit 6ab7e19

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ if(ENABLE_IPV6 AND NOT WIN32)
302302
endif()
303303

304304
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_ARES)
305-
set(use_core_foundation ON)
305+
set(use_core_foundation_and_core_services ON)
306306

307307
find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration")
308308
if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
@@ -445,7 +445,7 @@ if(CURL_WINDOWS_SSPI)
445445
endif()
446446

447447
if(CURL_USE_SECTRANSP)
448-
set(use_core_foundation ON)
448+
set(use_core_foundation_and_core_services ON)
449449

450450
find_library(SECURITY_FRAMEWORK "Security")
451451
if(NOT SECURITY_FRAMEWORK)
@@ -457,13 +457,18 @@ if(CURL_USE_SECTRANSP)
457457
list(APPEND CURL_LIBS "-framework Security")
458458
endif()
459459

460-
if(use_core_foundation)
460+
if(use_core_foundation_and_core_services)
461461
find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation")
462+
find_library(CORESERVICES_FRAMEWORK "CoreServices")
463+
462464
if(NOT COREFOUNDATION_FRAMEWORK)
463465
message(FATAL_ERROR "CoreFoundation framework not found")
464466
endif()
467+
if(NOT CORESERVICES_FRAMEWORK)
468+
message(FATAL_ERROR "CoreServices framework not found")
469+
endif()
465470

466-
list(APPEND CURL_LIBS "-framework CoreFoundation")
471+
list(APPEND CURL_LIBS "-framework CoreFoundation -framework CoreServices")
467472
endif()
468473

469474
if(CURL_USE_OPENSSL)

m4/curl-sectransp.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if test "x$OPT_SECURETRANSPORT" != xno; then
3333
ssl_msg="Secure Transport"
3434
test secure-transport != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
3535
SECURETRANSPORT_ENABLED=1
36-
LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
36+
LDFLAGS="$LDFLAGS -framework CoreFoundation -framework CoreServices -framework Security"
3737
else
3838
AC_MSG_RESULT(no)
3939
fi

m4/curl-sysconfig.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#***************************************************************************
2424

2525
AC_DEFUN([CURL_DARWIN_SYSTEMCONFIGURATION], [
26-
AC_MSG_CHECKING([whether to link macOS CoreFoundation and SystemConfiguration framework])
26+
AC_MSG_CHECKING([whether to link macOS CoreFoundation, CoreServices, and SystemConfiguration frameworks])
2727
case $host_os in
2828
darwin*)
2929
AC_COMPILE_IFELSE([
@@ -43,7 +43,7 @@ case $host_os in
4343
])
4444
if test "x$build_for_macos" != xno; then
4545
AC_MSG_RESULT(yes)
46-
LDFLAGS="$LDFLAGS -framework CoreFoundation -framework SystemConfiguration"
46+
LDFLAGS="$LDFLAGS -framework CoreFoundation -framework CoreServices -framework SystemConfiguration"
4747
else
4848
AC_MSG_RESULT(no)
4949
fi

0 commit comments

Comments
 (0)