-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
90 lines (75 loc) · 1.99 KB
/
CMakeLists.txt
File metadata and controls
90 lines (75 loc) · 1.99 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
cmake_minimum_required(VERSION 3.16)
project(GhostLink VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Compiler flags
if(MSVC)
add_compile_options(/W4 /WX- /permissive-)
add_compile_definitions(_WIN32_WINNT=0x0A00 UNICODE _UNICODE)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# Source files
set(CORE_SOURCES
src/core/channel_manager.cpp
src/core/crypto.cpp
src/core/protocol.cpp
)
set(CHANNEL_SOURCES
src/channels/dns_tunnel.cpp
src/channels/https_beacon.cpp
src/channels/named_pipe.cpp
src/channels/icmp_channel.cpp
)
set(ENCODING_SOURCES
src/encoding/base32.cpp
src/encoding/steganography.cpp
)
set(UTIL_SOURCES
src/utils/jitter.cpp
)
# GhostLink static library
add_library(ghostlink_lib STATIC
${CORE_SOURCES}
${CHANNEL_SOURCES}
${ENCODING_SOURCES}
${UTIL_SOURCES}
)
target_include_directories(ghostlink_lib PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
)
# Link Windows libraries
if(WIN32)
target_link_libraries(ghostlink_lib PUBLIC
bcrypt
winhttp
ws2_32
ntdll
iphlpapi
)
endif()
# Main executable
add_executable(ghostlink src/main.cpp)
target_link_libraries(ghostlink PRIVATE ghostlink_lib)
# Tests
option(BUILD_TESTS "Build unit tests" ON)
if(BUILD_TESTS)
enable_testing()
add_executable(test_crypto tests/test_crypto.cpp)
target_link_libraries(test_crypto PRIVATE ghostlink_lib)
add_test(NAME CryptoTests COMMAND test_crypto)
add_executable(test_dns_encoding tests/test_dns_encoding.cpp)
target_link_libraries(test_dns_encoding PRIVATE ghostlink_lib)
add_test(NAME DnsEncodingTests COMMAND test_dns_encoding)
endif()
# Install
install(TARGETS ghostlink DESTINATION bin)
install(TARGETS ghostlink_lib DESTINATION lib)
install(DIRECTORY src/ DESTINATION include/ghostlink
FILES_MATCHING PATTERN "*.h"
)