-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
260 lines (227 loc) · 7.26 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#
#
#
#
#
# Check the minimum required cmake version for this project
cmake_minimum_required(VERSION 2.6)
###
# Change to also build cpp files
# -> seems to not help, so commented out
PROJECT(smbtatools)
#PROJECT(smbtatools C)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
set(APPLICATION_NAME "smbtatools")
set(APPLICATION_VERSION "0.0.1")
INCLUDE(${CMAKE_SOURCE_DIR}/FindSqlite.cmake)
# Build debugging enabled binaries
SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_C_FLAGS_DEBUG "-g -Wall")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
#SET(CMAKE_VERBOSE_MAKEFILE ON)
#
# check for QT(4)
#
FIND_PACKAGE(Qt4)
IF (NOT QT_INCLUDE_DIR)
MESSAGE( FATAL_ERROR "ERROR: you need the qt development files and library installed.")
ENDIF()
IF (QT_INCLUDE_DIR)
INCLUDE_DIRECTORIES($QT_INCLUDE_DIR)
ENDIF()
#
# check for pango
#
FIND_PACKAGE(PANGO)
IF (NOT LIBPANGO_INCLUDE_DIRS)
MESSAGE( FATAL_ERROR "ERROR: you need the pango library and headers installed.")
ENDIF()
IF (LIBPANGO_INCLUDE_DIRS)
INCLUDE_DIRECTORIES($LIBPANGO_INCLUDE_DIRS)
ENDIF()
#
# check for cairo
#
FIND_PACKAGE(CAIRO)
if (NOT LIBCAIRO_INCLUDE_DIRS)
MESSAGE( FATAL_ERROR "ERROR: you need the cairo library and headers installed.")
ENDIF()
IF (LIBCAIRO_INCLUDE_DIRS)
INCLUDE_DIRECTORIES($LIBCAIRO_INCLUDE_DIRS)
ENDIF()
#
# check for libcurl
#
FIND_PACKAGE(CURL)
if (NOT CURL_INCLUDE_DIRS)
MESSAGE( FATAL_ERROR "ERROR: you will need curl development files installed.")
ENDIF()
if (CURL_INCLUDE_DIRS)
INCLUDE_DIRECTORIES($CURL_INCLUDE_DIRS)
ENDIF()
# compile on SunOS
if (CMAKE_SYSTEM_NAME STREQUAL "SunOS" )
ADD_DEFINITIONS(-DSOLARIS)
SET(Libraries
${Libraries}
socket
nsl)
endif()
#
# check for libdbi
#
include(FindLibDBI.cmake)
FIND_PACKAGE(LibDBI)
if (NOT LIBDBI_INCLUDE_DIR)
MESSAGE( FATAL_ERROR "ERROR: you will need the libdbi development files installed.")
ENDIF()
if (LIBDBI_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${LIBDBI_INCLUDE_DIR})
ENDIF()
#
# check for sqlite3
#
include(FindSqlite.cmake)
FIND_PACKAGE(Sqlite)
if (NOT SQLITE_FOUND OR CMAKE_FORCE_EMBEDDED_SQLITE)
MESSAGE( STATUS "----> FYI: Seems like there're no sqlite3 development files")
MESSAGE( STATUS " installed.")
MESSAGE( STATUS " That's ok, we will build the ")
MESSAGE( STATUS " sqlite amalgamation code then.")
SET(SQLITE_LIBRARIES "")
ELSEIF (SQLITE_FOUND)
MESSAGE( STATUS "----> FYI: Nice, your system provides sqlite >= 3.7.0, we")
MESSAGE( STATUS " will make the build linking shared to this library.")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D SQLITE_FOUND")
ENDIF()
#
# check for libsmbclient
#
include(FindLibsmbclient.cmake)
FIND_PACKAGE(Libsmbclient)
if (NOT LIBSMBCLIENT_INCLUDE_DIRS)
MESSAGE( FATAL_ERROR "ERROR: you will need libsmbclient
development files installed.")
ENDIF()
#
# check for talloc
#
include(FindTalloc.cmake)
FIND_PACKAGE(Talloc)
if (NOT TALLOC_INCLUDE_DIR)
MESSAGE( FATAL_ERROR "ERROR: you will need talloc development
files installed.")
ENDIF()
#
# include iniparser on demand
#
include(FindIniparser.cmake)
FIND_PACKAGE(Iniparser)
if (NOT INIPARSER_INCLUDE_DIR)
MESSAGE( STATUS "----> FYI: Unable to find iniparser libraries on your system")
MESSAGE( STATUS "----> compiling my own version and link it statically.")
add_custom_target(
buildiniparser ALL
COMMAND "make"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/iniparser3.0b"
COMMENT "Building iniparser."
VERBATIM )
ADD_LIBRARY(iniparser STATIC IMPORTED)
set_target_properties(iniparser PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/iniparser3.0b/libiniparser.a)
ENDIF()
#
# check for curses
#
FIND_PACKAGE(Curses)
if (NOT CURSES_HAVE_CURSES_H)
MESSAGE( FATAL_ERROR "ERROR: you will need curses development files installed.")
ENDIF()
#
# check for pthreads
#
FIND_PACKAGE(Threads)
if (NOT CMAKE_USE_PTHREADS_INIT)
MESSAGE( FATAL_ERROR "ERROR: you will need pthread development files installed.")
ENDIF()
INCLUDE_DIRECTORIES( ${SQLITE3_INCLUDE_DIRS} ${TALLOC_INCLUDE_DIR} ${LIBSMBCLIENT_INCLUDE_DIRS} )
SET(CurrentExe "smbtaquery")
ADD_EXECUTABLE(${CurrentExe}
src/query/sqlite/sqlite3.c
src/query/main.c
src/common/common.c
src/common/aes.c
src/common/rijndael-alg-fst.c
src/query/configuration.c
src/query/interpreter.c
src/query/network.c
src/query/convert.c
src/query/graphics.c
)
TARGET_LINK_LIBRARIES(${CurrentExe} ${LIBCAIRO_LIBRARIES} ${CURL_LIBRARIES} ${LIBDBI_LIBRARIES} ${INIPARSER_LIBRARIES} ${SQLITE_LIBRARIES} ${TALLOC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} iniparser dl)
SET(CurrentExe "smbtamonitor-gen")
ADD_EXECUTABLE(${CurrentExe}
src/monitor/main.c
src/common/common.c
src/common/aes.c
src/common/rijndael-alg-fst.c
src/monitor/configuration.c
src/monitor/network.c
src/monitor/monitor-list.c
)
TARGET_LINK_LIBRARIES(${CurrentExe} ${LIBDBI_LIBRARIES} ${CURSES_LIBRARIES} ${INIPARSER_LIBRARIES} ${TALLOC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} iniparser)
SET(CurrentExe "smbtatorture")
ADD_EXECUTABLE(${CurrentExe}
src/torture/smbtatorture.c
)
TARGET_LINK_LIBRARIES(${CurrentExe} ${LIBSMBCLIENT_LIBRARIES})
SET(CurrentExe "smbtatorturesrv")
ADD_EXECUTABLE(${CurrentExe}
src/torture/srv/smbtatorturesrv.c
)
TARGET_LINK_LIBRARIES(${CurrentExe} ${Libraries})
SET(CurrentExe "rrddriver")
ADD_EXECUTABLE(${CurrentExe}
src/webmon/rrddriver/main.c
src/common/common.c
src/common/aes.c
src/common/rijndael-alg-fst.c
src/webmon/rrddriver/configuration.c
src/webmon/rrddriver/network.c
src/webmon/rrddriver/monitor-list.c
)
TARGET_LINK_LIBRARIES(${CurrentExe} ${LIBDBI_LIBRARIES} ${INIPARSER_LIBRARIES} ${TALLOC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} iniparser)
SET(CurrentExe "smbtamonitor-cli")
ADD_EXECUTABLE(${CurrentExe}
src/monitor-cli/main.c
src/monitor-cli/configuration.c
src/common/common.c
src/common/aes.c
src/common/rijndael-alg-fst.c
)
TARGET_LINK_LIBRARIES(${CurrentExe} ${LIBDBI_LIBRARIES} ${INIPARSER_LIBRARIES} ${TALLOC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} iniparser)
# Adding the subdirectory for monitor-qt
add_subdirectory( src/monitor-qt )
# install documentation
INSTALL(FILES doc/smbtaquery.1
DESTINATION "share/man/man1"
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ RENAME smbtaquery.1)
INSTALL(FILES doc/smbtamonitor.1
DESTINATION "share/man/man1"
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ RENAME smbtamonitor.1)
INSTALL(FILES doc/smbtatorture.1
DESTINATION "share/man/man1"
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ RENAME smbtatorture.1)
#install xslt tranformers
INSTALL(FILES src/query/xslt/xslt-ascii.xml
DESTINATION "share/smbtatools"
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ RENAME xslt-ascii.xml)
INSTALL(FILES src/query/xslt/xslt-html.xml
DESTINATION "share/smbtatools"
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ RENAME xslt-html.xml)
INSTALL(FILES src/torture/srv/filenames.txt
DESTINATION "share/smbtatools"
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ RENAME filenames.txt)
INSTALL(FILES src/torture/srv/directories.txt
DESTINATION "share/smbtatools"
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ RENAME directories.txt)
INSTALL(TARGETS smbtaquery smbtamonitor-gen smbtamonitor-cli smbtatorture rrddriver smbtatorturesrv DESTINATION bin)