Files
shadowsocks-libev/cmake/FindCares.cmake
Max LvandClaude Opus 4.6 1c404eccf4 Modernize build: switch to CMake, add unit tests, fix man pages
Remove autotools (configure.ac, Makefile.am, m4/, autogen.sh) and make
CMake the sole build system. Enhance CMake with proper Find modules for
MbedTLS, libsodium, PCRE, and c-ares with version/feature detection.
Add support for connmarktos, nftables, stack protector, and MinGW.

Add 10 unit test suites (CTest) covering base64, buffer, cache, crypto,
jconf, json, netutils, ppbloom, rule, and utils modules. Add a Python
stress test measuring bandwidth per cipher with memory leak detection.

Fix man page typos ("Resovle" -> "Resolve"), document missing TCP buffer
options, fix ss-manager duplicate --executable entry, add example section
to ss-tunnel, and document --workdir and --nftables-sets options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:40:27 +08:00

45 lines
1.1 KiB
CMake

# FindCares.cmake - Find c-ares library
#
# Sets:
# CARES_FOUND
# CARES_INCLUDE_DIRS
# CARES_LIBRARIES
find_path(CARES_INCLUDE_DIR
NAMES ares.h
HINTS
/opt/homebrew/include
/usr/local/include
/opt/homebrew/opt/c-ares/include
/usr/local/opt/c-ares/include
/usr/include
)
find_library(CARES_LIBRARY
NAMES cares
HINTS
/opt/homebrew/lib
/usr/local/lib
/opt/homebrew/opt/c-ares/lib
/usr/local/opt/c-ares/lib
/usr/lib
)
if(CARES_INCLUDE_DIR AND CARES_LIBRARY)
set(CARES_FOUND TRUE)
set(CARES_INCLUDE_DIRS ${CARES_INCLUDE_DIR})
set(CARES_LIBRARIES ${CARES_LIBRARY})
# Verify ares_library_init exists
include(CheckLibraryExists)
check_library_exists(cares ares_library_init "" CARES_HAS_INIT)
if(NOT CARES_HAS_INIT)
message(WARNING "c-ares found but ares_library_init not detected. Proceeding anyway.")
endif()
message(STATUS "Found c-ares: ${CARES_LIBRARY}")
else()
set(CARES_FOUND FALSE)
message(FATAL_ERROR "Could not find c-ares library. Install libc-ares-dev or equivalent.")
endif()