-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (34 loc) · 1.61 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
cmake_minimum_required(VERSION 3.10)
project(ChatServerClient)
set(CMAKE_CXX_STANDARD 14)
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
find_package(Boost REQUIRED COMPONENTS system thread)
include_directories(${Boost_INCLUDE_DIRS})
include(FetchContent)
FetchContent_Declare(
json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.10.5
)
FetchContent_MakeAvailable(json)
include_directories(${CMAKE_SOURCE_DIR}/external)
include_directories(${CMAKE_SOURCE_DIR}/external/doctest)
include_directories(${CMAKE_SOURCE_DIR}/common)
include_directories(${CMAKE_SOURCE_DIR}/client)
include_directories(${CMAKE_SOURCE_DIR}/server)
configure_file(${CMAKE_SOURCE_DIR}/config/config.json ${CMAKE_BINARY_DIR}/config/config.json COPYONLY)
add_compile_definitions(SIGSTKSZ=8192)
# Указываем правильные пути к исходным файлам
add_executable(server server/server.cpp)
target_link_libraries(server ${Boost_LIBRARIES} nlohmann_json::nlohmann_json)
add_executable(client client/client.cpp)
target_link_libraries(client ${Boost_LIBRARIES} nlohmann_json::nlohmann_json)
enable_testing()
add_executable(test_client tests/test_client.cpp client/client.cpp)
target_compile_definitions(test_client PRIVATE UNIT_TEST)
target_link_libraries(test_client ${Boost_LIBRARIES} nlohmann_json::nlohmann_json)
add_test(NAME test_client COMMAND test_client)
add_executable(test_server tests/test_server.cpp server/server.cpp)
target_compile_definitions(test_server PRIVATE UNIT_TEST)
target_link_libraries(test_server ${Boost_LIBRARIES} nlohmann_json::nlohmann_json)
add_test(NAME test_server COMMAND test_server)