Files
shadowsocks-libev/tests/consumer/CMakeLists.txt
Max Lv 335eb10742 Add an embedding API: ss_local_start/stop/wait and a C++ wrapper
<shadowsocks/control.h> starts ss-local on a library-owned thread,
stops it from any thread through a libuv async handle and waits for it;
<shadowsocks/shadowsocks.hpp> wraps that in a move-only, header-only
shadowsocks::LocalServer whose destructor stops and waits. The library
exports only C symbols, shadowsocks.h is unchanged, and the shared
library version becomes 2.1.0 (SOVERSION 2). test_local_api_cpp covers
the lifecycle; the installed-package consumer gains a C++ program.
2026-10-15 00:34:30 +08:00

26 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.20)
project(shadowsocks_consumer LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(SS_PACKAGE_NAME shadowsocks-c CACHE STRING "Installed package to test")
find_package(${SS_PACKAGE_NAME} CONFIG REQUIRED)
foreach(kind shared static)
if(TARGET shadowsocks::${kind})
if(SS_PACKAGE_NAME STREQUAL "shadowsocks-libev")
# Exercise legacy filenames as well as legacy package discovery.
foreach(property IMPORTED_LOCATION IMPORTED_IMPLIB)
get_target_property(location shadowsocks::${kind} ${property})
if(location)
get_filename_component(directory "${location}" DIRECTORY)
get_filename_component(filename "${location}" NAME)
string(REPLACE "shadowsocks-c" "shadowsocks-libev" filename "${filename}")
set_property(TARGET shadowsocks::${kind} PROPERTY ${property} "${directory}/${filename}")
endif()
endforeach()
endif()
add_executable(consumer_${kind} main.c)
target_link_libraries(consumer_${kind} PRIVATE shadowsocks::${kind})
add_executable(consumer_cxx_${kind} main.cpp)
target_link_libraries(consumer_cxx_${kind} PRIVATE shadowsocks::${kind})
endif()
endforeach()