-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·54 lines (38 loc) · 1.93 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
# 设置最低版本要求
cmake_minimum_required(VERSION 3.5)
# 设置项目名称
project(simple_rpc)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
file(GLOB SRC_LIST_COMMON ${CMAKE_CURRENT_SOURCE_DIR}/rocket/common/*.cc)
file(GLOB SRC_LIST_NET ${CMAKE_CURRENT_SOURCE_DIR}/rocket/net/*.cc)
file(GLOB SRC_LIST_NET_TCP ${CMAKE_CURRENT_SOURCE_DIR}/rocket/net/tcp/*.cc)
file(GLOB SRC_LIST_NET_CODER ${CMAKE_CURRENT_SOURCE_DIR}/rocket/net/coder/*.cc)
file(GLOB SRC_LIST_NET_RPC ${CMAKE_CURRENT_SOURCE_DIR}/rocket/net/rpc/*.cc)
file(GLOB SRC_LIST_PROTOBUF ${CMAKE_CURRENT_SOURCE_DIR}/protobuf/*.cc)
set(SRC_LIST ${SRC_LIST_COMMON} ${SRC_LIST_NET} ${SRC_LIST_NET_TCP} ${SRC_LIST_NET_CODER} ${SRC_LIST_NET_RPC} ${SRC_LIST_PROTOBUF})
message(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/rocket/common)
include_directories(${PROJECT_SOURCE_DIR}/rocket/net)
include_directories(${PROJECT_SOURCE_DIR}/rocket/net/tcp)
include_directories(${PROJECT_SOURCE_DIR}/rocket/net/coder)
include_directories(${PROJECT_SOURCE_DIR}/rocket/net/rpc)
include_directories(${PROJECT_SOURCE_DIR}/protobuf)
message(${PROJECT_SOURCE_DIR})
# message(${SRC_LIST})
# 添加可执行文件生成
add_executable(example_server testcases/example_server.cc ${SRC_LIST})
add_executable(example_client testcases/example_client.cc ${SRC_LIST})
# add_executable(test_log testcases/test_log.cc ${SRC_LIST})
# 添加线程库
target_link_libraries(example_server pthread)
target_link_libraries(example_client pthread)
# target_link_libraries(test_log pthread)
target_link_libraries(example_server tinyxml)
target_link_libraries(example_client tinyxml)
# target_link_libraries(test_log tinyxml)
target_link_libraries(example_server protobuf)
target_link_libraries(example_client protobuf)
# sudo code --user-data-dir ="~/.vscode-root" --no-sandbox