-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
executable file
·81 lines (71 loc) · 2.69 KB
/
Copy pathCMakeLists.txt
File metadata and controls
executable file
·81 lines (71 loc) · 2.69 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
cmake_minimum_required(VERSION 2.8)
project(zbinbin)
# 详细显示make的信息
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# 设置编译参数
set(CMAKE_CXX_FLAGS
"$ENV{CXXFLAGS} -rdynamic -O1 -g -std=c++14 -Wall -Wno-deprecated -Werror -Wno-unused-function -pthread")
include_directories(.)
# 设置编译的源码
set(LIB_SRC
zbinbin/utility/Timestamp.cpp
zbinbin/log/LogStream.cpp
zbinbin/log/Logging.cpp
zbinbin/log/AsyncLogging.cpp
zbinbin/thread/Thread.cpp
zbinbin/thread/Condition.cpp
zbinbin/thread/CurrentThread.cpp
zbinbin/thread/CountDownLatch.cpp
zbinbin/thread/ThreadPool.cpp
zbinbin/net/InetAddress.cpp
zbinbin/net/SocketOps.cpp
zbinbin/net/Socket.cpp
zbinbin/net/Buffer.cpp
zbinbin/net/Channel.cpp
zbinbin/net/Poller.cpp
zbinbin/net/EventLoop.cpp
zbinbin/net/Acceptor.cpp
zbinbin/net/TcpConnection.cpp
zbinbin/net/EventLoopThread.cpp
zbinbin/net/EventLoopThreadPool.cpp
zbinbin/net/TcpServer.cpp
zbinbin/http/HttpRequest.cpp
zbinbin/http/HttpResponse.cpp
zbinbin/http/HttpServer.cpp
)
# 添加一个lib的share库,生成so文件
add_library(zbinbin SHARED ${LIB_SRC})
# add_library(zbinbin_static STATIC ${LIB_SRC})
# SET_TARGET_PROPERTIES (zbinbin_static PROERTIES OUTPUT_NAME "zbinbin")
# 生成一个测试文件
# add_executable(test tests/test.cpp)
# add_executable(thread_test tests/thread.cpp)
add_executable(log_test tests/log_test.cpp)
add_executable(AsyncLogging_test tests/AsyncLogging_test.cpp)
add_executable(Buffer_test tests/Buffer_test.cpp)
add_executable(EventLoop_test tests/EventLoop_test.cpp)
add_executable(TcpServer_test tests/TcpServer_test.cpp)
add_executable(HttpRequest_test zbinbin/http/tests/HttpRequest_test.cpp)
add_executable(HttpServer_test zbinbin/http/tests/HttpServer_test.cpp)
# 测试文件依赖于zbinbin
# add_dependencies(test zbinbin)
# add_dependencies(thread_test zbinbin)
add_dependencies(log_test zbinbin)
add_dependencies(AsyncLogging_test zbinbin)
add_dependencies(Buffer_test zbinbin)
add_dependencies(EventLoop_test zbinbin)
add_dependencies(TcpServer_test zbinbin)
add_dependencies(HttpRequest_test zbinbin)
add_dependencies(HttpServer_test zbinbin)
# target_link_libraries(test zbinbin)
# target_link_libraries(thread_test zbinbin)
target_link_libraries(log_test zbinbin)
target_link_libraries(AsyncLogging_test zbinbin)
target_link_libraries(Buffer_test zbinbin)
target_link_libraries(EventLoop_test zbinbin)
target_link_libraries(TcpServer_test zbinbin)
target_link_libraries(HttpRequest_test zbinbin)
target_link_libraries(HttpServer_test zbinbin)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)