-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
125 lines (101 loc) · 3.05 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
cmake_minimum_required (VERSION 2.6)
project(MultiServer)
enable_language(CXX)
set (MultiServer_VERSION_MAJOR 0)
set (MultiServer_VERSION_MINOR 7)
if (Prefix)
set (InstallDirectory ${Prefix}/bin/)
else ()
set (InstallDirectory ${CMAKE_BINARY_DIR}/bin/)
endif ()
find_program(_GIT_EXEC
NAMES
git git.cmd
HINTS
ENV PATH
DOC "git installation path"
)
set(_GIT_COMMIT_DATE "0000-00-00 00:00:00 +0000")
if (_GIT_EXEC)
execute_process(
COMMAND "${_GIT_EXEC}" log --pretty=%H -n 1
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE _GIT_LONG_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND "${_GIT_EXEC}" log --pretty=%h -n 1
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE _GIT_SHORT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND "${_GIT_EXEC}" log --pretty=%aD -n 1
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE _GIT_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
message("Commit ${_GIT_LONG_COMMIT_HASH} Short Commit ${_GIT_SHORT_COMMIT_HASH} Commit Date ${_GIT_COMMIT_DATE}")
endif(_GIT_EXEC)
configure_file(
"${CMAKE_SOURCE_DIR}/revision.h.in.cmake"
"${CMAKE_BINARY_DIR}/revision.h"
@ONLY
)
include_directories(
${PROJECT_SOURCE_DIR}/
${PROJECT_SOURCE_DIR}/Application/
${PROJECT_SOURCE_DIR}/Handling/
${PROJECT_SOURCE_DIR}/Shared/
${PROJECT_SOURCE_DIR}/DataArrays/
${PROJECT_SOURCE_DIR}/SimpleLog/
${PROJECT_SOURCE_DIR}/ConfigMgr/
${PROJECT_SOURCE_DIR}/Signal/
${PROJECT_SOURCE_DIR}/Threads/
${PROJECT_SOURCE_DIR}/Sockets/
${PROJECT_SOURCE_DIR}/Utilities/
${PROJECT_SOURCE_DIR}/Daemon/
${PROJECT_SOURCE_DIR}/MySQL/
${CMAKE_BINARY_DIR}
)
set(CMAKE_CXX_FLAGS " -W -Wall -O2 -ldl -rdynamic -pthread -g")
set(CMAKE_BUILD_TYPE debug)
set (MultiServer_LINK_FLAGS ${CMAKE_CXX_FLAGS})
add_definitions(${CMAKE_CXX_FLAGS})
set (STAT_CORE
Utilities/Utils.cpp
DataArrays/binData.cpp
DataArrays/file.cpp
SimpleLog/SimpleLog.cpp
Shared/Shared.cpp
Signal/SignalHandler.cpp
Sockets/Socket.cpp
Sockets/SocketMgr.cpp
Threads/Thread.cpp
Threads/ThreadMgr.cpp
ConfigMgr/ConfigMgr.cpp
Handling/Handler.cpp
Application/Application.cpp
Daemon/Daemon.cpp
)
set (STAT_MAIN main.cpp)
message("")
message("***** Preparing Core *****")
add_library(Core STATIC ${STAT_CORE})
target_link_libraries(Core ${CMAKE_DL_LIBS} Core)
add_dependencies(Core revision.h)
add_executable(MultiServer ${STAT_MAIN})
set_target_properties(MultiServer PROPERTIES LINK_FLAGS ${MultiServer_LINK_FLAGS})
target_link_libraries(MultiServer ${CMAKE_DL_LIBS} Core)
message("-> Core prepared")
if (Protocols)
add_subdirectory(Protocol)
endif (Protocols)
file(MAKE_DIRECTORY ${InstallDirectory})
install(TARGETS MultiServer DESTINATION ${InstallDirectory})
if (NOT EXISTS "${InstallDirectory}config.conf")
install(FILES config.conf DESTINATION ${InstallDirectory})
endif (NOT EXISTS "${InstallDirectory}config.conf")