forked from snort3/snort3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
215 lines (180 loc) · 5.06 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
cmake_minimum_required (VERSION 3.4.3)
project (snort CXX C)
set (VERSION_MAJOR 3)
set (VERSION_MINOR 3)
set (VERSION_PATCH 6)
set (VERSION_SUBLEVEL 0)
set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_SUBLEVEL}")
if (DEFINED VERSION_BUILD)
set (BUILD "${VERSION_BUILD}")
endif ()
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_C_STANDARD 99)
set (CMAKE_C_STANDARD_REQUIRED ON)
set (CMAKE_C_EXTENSIONS ON)
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Pull in definitions of various install directories
include (GNUInstallDirs)
include (${CMAKE_MODULE_PATH}/macros.cmake)
include (${CMAKE_MODULE_PATH}/create_options.cmake)
include (${CMAKE_MODULE_PATH}/include_libraries.cmake)
include (${CMAKE_MODULE_PATH}/platforms.cmake)
include (${CMAKE_MODULE_PATH}/configure_options.cmake)
#include (${CMAKE_MODULE_PATH}/compiler_features.cmake)
include (${CMAKE_MODULE_PATH}/sanity_checks.cmake)
set (INSTALL_SUFFIX "${CMAKE_PROJECT_NAME}")
set (INCLUDE_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}/${INSTALL_SUFFIX}")
set (LIB_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}/${INSTALL_SUFFIX}")
set (PLUGIN_INSTALL_PATH "${LIB_INSTALL_PATH}/plugins")
configure_file (
"${PROJECT_SOURCE_DIR}/config.cmake.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
add_definitions( -DHAVE_CONFIG_H )
# Set these after all tests are done but *before* any subdirectories are included
# or other targets declared.
string(APPEND CMAKE_C_FLAGS " ${EXTRA_C_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${EXTRA_CXX_FLAGS}")
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${EXTRA_LINKER_FLAGS}")
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${EXTRA_LINKER_FLAGS}")
include_directories (${PROJECT_BINARY_DIR})
include_directories (${PROJECT_SOURCE_DIR})
if (ENABLE_UNIT_TESTS)
include(CTest)
endif (ENABLE_UNIT_TESTS)
if (ENABLE_UNIT_TESTS OR ENABLE_BENCHMARK_TESTS)
add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND})
endif (ENABLE_UNIT_TESTS OR ENABLE_BENCHMARK_TESTS)
add_subdirectory (src)
add_subdirectory (tools)
add_subdirectory (lua)
add_subdirectory (daqs)
if ( MAKE_DOC )
add_subdirectory (doc)
endif ( MAKE_DOC )
# Miscellaneous stuff. Does NOT directly affect Snort's build environment.
include (${CMAKE_MODULE_PATH}/packaging_data.cmake)
include (${CMAKE_MODULE_PATH}/create_pkg_config.cmake)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
message("
-------------------------------------------------------")
if (DEFINED BUILD)
message("${CMAKE_PROJECT_NAME} version ${VERSION} build ${BUILD}")
else()
message("${CMAKE_PROJECT_NAME} version ${VERSION}")
endif()
message("
Install options:
prefix: ${CMAKE_INSTALL_PREFIX}
includes: ${CMAKE_INSTALL_FULL_INCLUDEDIR}/${INSTALL_SUFFIX}
plugins: ${CMAKE_INSTALL_FULL_LIBDIR}/${INSTALL_SUFFIX}
Compiler options:
CC: ${CMAKE_C_COMPILER}
CXX: ${CMAKE_CXX_COMPILER}
CFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}
CXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}
EXE_LDFLAGS: ${CMAKE_EXE_LINKER_FLAGS}
MODULE_LDFLAGS: ${CMAKE_MODULE_LINKER_FLAGS}
Feature options:\
")
if (ENABLE_STATIC_DAQ)
message("\
DAQ Modules: Static (${DAQ_STATIC_MODULES})")
else ()
message("\
DAQ Modules: Dynamic")
endif ()
if (HAVE_ATOMIC)
message("\
libatomic: User-specified")
else ()
message("\
libatomic: System-provided")
endif ()
if (HAVE_HYPERSCAN)
message("\
Hyperscan: ON")
else ()
message("\
Hyperscan: OFF")
endif ()
if (HAVE_ICONV)
message("\
ICONV: ON")
else ()
message("\
ICONV: OFF")
endif ()
if (HAVE_LIBUNWIND)
message("\
Libunwind: ON")
else ()
message("\
Libunwind: OFF")
endif ()
if (HAVE_LZMA)
message("\
LZMA: ON")
else ()
message("\
LZMA: OFF")
endif ()
if (USE_TIRPC)
message("\
RPC DB: TIRPC")
else ()
message("\
RPC DB: Built-in")
endif ()
if (HAVE_SAFEC)
message("\
SafeC: ON")
else ()
message("\
SafeC: OFF")
endif ()
if (HAVE_TCMALLOC)
message("\
TCMalloc: ON")
else ()
message("\
TCMalloc: OFF")
endif ()
if (HAVE_JEMALLOC)
message("\
JEMalloc: ON")
else ()
message("\
JEMalloc: OFF")
endif ()
if (HAVE_UUID)
message("\
UUID: ON")
else ()
message("\
UUID: OFF")
endif ()
if (HAVE_NUMA)
message("\
NUMA: ON")
else ()
message("\
NUMA: OFF")
endif ()
if (HAVE_LIBML)
message("\
LibML: ON")
else ()
message("\
LibML: OFF")
endif ()
message("-------------------------------------------------------\n")