-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathCMakeLists.txt
41 lines (35 loc) · 1.15 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
cmake_minimum_required(VERSION 3.8)
# 如果支持,请为 MSVC 编译器启用热重载。
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
project("yuze" C)
# 设置源代码文件
set(SRCFILE
"src/debug.c"
"src/forward.c"
"src/getopt.c"
"src/main.c"
"src/portTransmit.c"
"src/reverse.c"
"src/socks5Proto.c"
"src/socks5Proxy.c"
"src/socksAPI.c"
"src/tunnelSock2sock.c"
)
# 将源代码添加到此项目的可执行文件。
add_executable(yuze ${SRCFILE})
# 根据平台条件链接适当的线程库
if(WIN32)
# Windows 平台,使用 Windows 的线程库,不需要 pthread
target_link_libraries(yuze PRIVATE)
else()
# Linux 和 macOS 平台,链接 pthread 库
target_link_libraries(yuze PRIVATE pthread)
endif()
# 设置 C 标准
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET yuze PROPERTY C_STANDARD 11)
endif()
# TODO: 如有需要,请添加测试并安装目标。