-
Notifications
You must be signed in to change notification settings - Fork 29
/
CMakeLists.txt
72 lines (60 loc) · 1.76 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Set the minimum version of CMake that can be used
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 14)
cmake_policy(SET CMP0065 NEW)
if (STATIC_BINARY)
message("Building static portable binary with small size")
endif ()
# Set the project name
project(DPITunnel-cli)
# Add dependencies
add_subdirectory(RawSocket)
add_subdirectory(cpp-httplib)
add_subdirectory(dnslib)
add_subdirectory(libnl)
# Add an executable
add_executable(DPITunnel-cli-exec
autoconf.cpp
desync.cpp
dns.cpp
dpitunnel-cli.cpp
netiface.cpp
packet.cpp
profiles.cpp
socket.cpp
ssl.cpp
utils.cpp
)
if (STATIC_BINARY)
target_link_libraries(DPITunnel-cli-exec -static)
target_link_options(DPITunnel-cli-exec PRIVATE "LINKER:--gc-sections")
target_link_options(DPITunnel-cli-exec PRIVATE "LINKER:-s")
target_compile_options(DPITunnel-cli-exec PRIVATE -ffunction-sections)
endif ()
# Set the directories that should be included in the build command for this target
target_include_directories(DPITunnel-cli-exec
PRIVATE
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/RawSocket/include
${PROJECT_SOURCE_DIR}/cpp-httplib/include
${PROJECT_SOURCE_DIR}/dnslib/include
${PROJECT_SOURCE_DIR}/libnl/include
)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if (STATIC_BINARY)
set(OPENSSL_USE_STATIC_LIBS TRUE)
endif ()
find_package(OpenSSL REQUIRED)
target_link_libraries(DPITunnel-cli-exec
RawSocket
cpp-httplib
dnslib
libnl
Threads::Threads
OpenSSL::SSL
OpenSSL::Crypto
)
if (STATIC_BINARY)
target_link_libraries(DPITunnel-cli-exec ${CMAKE_DL_LIBS})
endif ()