-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
160 lines (133 loc) · 3.99 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
cmake_minimum_required (VERSION 3.4.3)
project (snort CXX C)
set (VERSION_MAJOR 3)
set (VERSION_MINOR 0)
set (VERSION_PATCH 0)
set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
set (CMAKE_CXX_STANDARD 11)
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 (PLUGIN_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}/${INSTALL_SUFFIX}")
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}")
foreach (EXTRA_LIBRARY IN LISTS EXTRA_LIBRARIES)
link_libraries(${EXTRA_LIBRARY})
endforeach (EXTRA_LIBRARY)
include_directories (${PROJECT_BINARY_DIR})
include_directories (${PROJECT_SOURCE_DIR})
if (ENABLE_UNIT_TESTS)
include(CTest)
add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND})
endif (ENABLE_UNIT_TESTS)
add_subdirectory (src)
add_subdirectory (tools)
add_subdirectory (lua)
add_subdirectory (doc)
add_subdirectory (daqs)
# 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)
message("
-------------------------------------------------------
${CMAKE_PROJECT_NAME} version ${VERSION}
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}
CXXFLAGS: ${CMAKE_CXX_FLAGS}
EXE_LDFLAGS: ${CMAKE_EXE_LINKER_FLAGS}
MODULE_LDFLAGS: ${CMAKE_MODULE_LINKER_FLAGS}
Feature options:\
")
if (HAVE_FLATBUFFERS)
message("\
Flatbuffers: ON")
else ()
message("\
Flatbuffers: OFF")
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_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 AND SAFEC_ENABLED)
message("\
SafeC: ON")
else ()
message("\
SafeC: OFF")
endif ()
if (HAVE_TCMALLOC)
message("\
TCMalloc: ON")
else ()
message("\
TCMalloc: OFF")
endif ()
if (HAVE_UUID)
message("\
UUID: ON")
else ()
message("\
UUID: OFF")
endif ()
message("-------------------------------------------------------\n")