--- CMakeLists.txt 2026-07-15 01:41:06.000000000 +0800 +++ CMakeLists.txt 2026-07-20 03:42:25.000000000 +0800 @@ -88,46 +88,7 @@ list(APPEND EVENT_LOOP_DEFINES "EPOLL") set(USE_S2N ON) -elseif (APPLE) - - file(GLOB AWS_IO_OS_HEADERS - ) - - file(GLOB AWS_IO_OS_SRC - "source/bsd/*.c" - "source/posix/*.c" - "source/darwin/*.c" - ) - - find_library(SECURITY_LIB Security) - find_library(NETWORK_LIB Network) - - # Enable dispatch queue if the libraries are available - if (NETWORK_LIB AND SECURITY_LIB) - list(APPEND PLATFORM_LIBS "-framework Security -framework Network") - list(APPEND EVENT_LOOP_DEFINES "DISPATCH_QUEUE") - endif () - - # Enable KQUEUE on MacOS only if AWS_USE_SECITEM is not declared. SecItem requires Dispatch Queue. - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT DEFINED AWS_USE_SECITEM) - list(APPEND EVENT_LOOP_DEFINES "KQUEUE") - endif() - - # On MacOS s2n-tls is optional (the Apple SecItem/Security framework provides a TLS implementation). - # Default to using s2n-tls only when SecItem is not requested. Users can override with -DUSE_S2N=ON/OFF. - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT DEFINED AWS_USE_SECITEM) - option(USE_S2N "Use s2n-tls as the TLS implementation." ON) - else() - option(USE_S2N "Use s2n-tls as the TLS implementation." OFF) - endif() - - # Force USE_S2N OFF to avoid pulling in an unused s2n dependency. - if (DEFINED AWS_USE_SECITEM AND USE_S2N) - message(WARNING "AWS_USE_SECITEM takes precedence over s2n-tls; forcing USE_S2N=OFF to avoid linking unused s2n.") - set(USE_S2N OFF CACHE BOOL "Use s2n-tls as the TLS implementation." FORCE) - endif() - -elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") +elseif (APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") file(GLOB AWS_IO_OS_HEADERS ) @@ -138,6 +99,7 @@ list(APPEND EVENT_LOOP_DEFINES "KQUEUE") set(USE_S2N ON) + add_definitions(-DAWS_APPLE_USE_S2N_ONLY) endif()