-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
200 lines (173 loc) · 7.32 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
cmake_minimum_required(VERSION 3.10)
project(EBCppExamples VERSION 0.1 LANGUAGES CXX)
# Require C++17 Standard
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
# Configure and Include EBCpp
set(EBCPP_USE_SSL Off) # On/Off - Using openssl for ssl sockets and https
set(EBCPP_USE_SSL_STATIC Off) # On/Off - Activate static linking of openssl into your application (see openssl license)
set(EBCPP_USE_SQLITE Off) # On/Off - Using sqlite in your application (static linked)
set(EBCPP_STATIC On) # On/Off - Static linking of libc, libc++ and winpthread
include(ebcpp.cmake)
# Compile EBCppExampleFile
add_executable(EBCppExample examples/Example.cpp)
if(WIN32)
target_link_libraries(EBCppExample -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExample pthread)
endif()
# Compile EBCppExcampleSignalSlot
add_executable(EBCppExampleSignalSlot examples/ExampleSignalSlot.cpp)
if(WIN32)
target_link_libraries(EBCppExampleSignalSlot -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleSignalSlot pthread)
endif()
# Compile EBCppExampleFile
add_executable(EBCppExampleFile examples/ExampleFile.cpp)
if(WIN32)
target_link_libraries(EBCppExampleFile -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleFile pthread)
endif()
# Compile EBCppExampleTimer
add_executable(EBCppExampleTimer examples/ExampleTimer.cpp)
if(WIN32)
target_link_libraries(EBCppExampleTimer -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleTimer pthread)
endif()
# Compile EBCppExampleTcpClient
add_executable(EBCppExampleTcpClient examples/ExampleTcpClient.cpp)
if(WIN32)
target_link_libraries(EBCppExampleTcpClient wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleTcpClient pthread)
endif()
# Compile EBCppExampleTcpServer
add_executable(EBCppExampleTcpServer examples/ExampleTcpServer.cpp)
if(WIN32)
target_link_libraries(EBCppExampleTcpServer wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleTcpServer pthread)
endif()
# Compile EBCppExampleHttpServer
add_executable(EBCppExampleHttpServer examples/ExampleHttpServer.cpp)
if(WIN32)
target_link_libraries(EBCppExampleHttpServer wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleHttpServer pthread)
endif()
# Compile EBCppExampleHttpClient
add_executable(EBCppExampleHttpClient examples/ExampleHttpClient.cpp)
if(WIN32)
target_link_libraries(EBCppExampleHttpClient wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleHttpClient pthread)
endif()
if(WIN32)
# Compile EBCppExampleHttpClient
#add_executable(EBCppExampleICMP examples/ExampleICMP.cpp)
#if(WIN32)
# target_link_libraries(EBCppExampleICMP iphlpapi wsock32 ws2_32 -Wl,-subsystem,console)
#else()
# target_link_libraries(EBCppExampleICMP pthread)
#endif()
# Compile EBCppExampleSerialPort
add_executable(EBCppExampleSerialPort examples/ExampleSerialPort.cpp)
if(WIN32)
target_link_libraries(EBCppExampleSerialPort wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleSerialPort pthread)
endif()
endif()
find_package(OpenSSL)
if(OPENSSL_FOUND)
# Compile EBCppExampleHttpServer
add_executable(EBCppExampleWebSocketServer examples/ExampleWebSocketServer.cpp)
target_include_directories(EBCppExampleWebSocketServer PRIVATE ${OPENSSL_INCLUDE_DIR})
if(WIN32)
target_link_libraries(EBCppExampleWebSocketServer OpenSSL::Crypto OpenSSL::SSL wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleWebSocketServer OpenSSL::Crypto OpenSSL::SSL pthread)
endif()
# Compile EBCppExampleSSLClient
add_executable(EBCppExampleSSLClient examples/ExampleSSLClient.cpp)
target_include_directories(EBCppExampleSSLClient PRIVATE ${OPENSSL_INCLUDE_DIR})
if(WIN32)
target_link_libraries(EBCppExampleSSLClient OpenSSL::Crypto OpenSSL::SSL wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleSSLClient OpenSSL::Crypto OpenSSL::SSL pthread)
endif()
# Compile EBCppExampleSSLServer
add_executable(EBCppExampleSSLServer examples/ExampleSSLServer.cpp)
target_include_directories(EBCppExampleSSLServer PRIVATE ${OPENSSL_INCLUDE_DIR})
if(WIN32)
target_link_libraries(EBCppExampleSSLServer OpenSSL::Crypto OpenSSL::SSL wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleSSLServer OpenSSL::Crypto OpenSSL::SSL pthread)
endif()
# Compile EBCppExampleHttpsServer
add_executable(EBCppExampleHttpsServer examples/ExampleHttpsServer.cpp)
target_include_directories(EBCppExampleHttpsServer PRIVATE ${OPENSSL_INCLUDE_DIR})
if(WIN32)
target_link_libraries(EBCppExampleHttpsServer OpenSSL::Crypto OpenSSL::SSL wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleHttpsServer OpenSSL::Crypto OpenSSL::SSL pthread)
endif()
# Compile EBCppExampleHttpClient
add_executable(EBCppExampleHttpsClient examples/ExampleHttpsClient.cpp)
if(WIN32)
target_link_libraries(EBCppExampleHttpsClient OpenSSL::Crypto OpenSSL::SSL wsock32 ws2_32 -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleHttpsClient OpenSSL::Crypto OpenSSL::SSL pthread)
endif()
endif()
# Compile EBCppExampleJSON
add_executable(EBCppExampleJSON examples/ExampleJSON.cpp)
if(WIN32)
target_link_libraries(EBCppExampleJSON -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleJSON pthread)
endif()
# Compile EBCppExampleJSONParse
add_executable(EBCppExampleJSONParse examples/ExampleJSONParse.cpp)
if(WIN32)
target_link_libraries(EBCppExampleJSONParse -Wl,-subsystem,console)
else()
target_link_libraries(EBCppExampleJSONParse pthread)
endif()
add_subdirectory(test)
find_package(Doxygen OPTIONAL_COMPONENTS dot)
#if( DOXYGEN_FOUND )
if( Off )
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "README.md")
#set(DOXYGEN_PROJECT_LOGO "${CMAKE_SOURCE_DIR}/doc/images/o2_logo.png")
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../doc)
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_HIDE_UNDOC_RELATIONS NO)
set(DOXYGEN_HAVE_DOT YES)
set(DOXYGEN_DOT_NUM_THREADS 1)
set(DOXYGEN_UML_LOOK YES)
set(DOXYGEN_UML_LIMIT_NUM_FIELDS 50)
set(DOXYGEN_TEMPLATE_RELATIONS YES)
set(DOXYGEN_DOT_IMAGE_FORMAT svg)
set(DOXYGEN_INTERACTIVE_SVG YES)
set(DOXYGEN_DOT_GRAPH_MAX_NODES 100)
set(DOXYGEN_DOT_TRANSPARENT YES)
set(DOXYGEN_MACRO_EXPANSION YES)
set(DOXYGEN_WARN_ID_UNDOCUMENTED NO)
set(DOXYGEN_PREDEFINED
"EB_SIGNAL(a) = EBCpp::EBEvent<> a"
"EB_SIGNAL_WITH_ARGS(a, b) = EBCpp::EBEvent<b> a"
"EB_SLOT(a) = void a( EBObject * sender )"
"EB_SLOT_WITH_ARGS(a, b) = void a( EBObject * sender, b )"
)
file(GLOB_RECURSE EBCppHeaders CONFIGURE_DEPENDS src/*.hpp src/**/*.hpp examples/*.cpp)
doxygen_add_docs(doxygen
${EBCppHeaders} README.md
ALL
COMMENT "Generating doxygen documentation for ${PROJECT_NAME}"
)
else(DOXYGEN_FOUND)
message("doxygen not found building without doxygen documentation")
endif(DOXYGEN_FOUND)