-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
60 lines (45 loc) · 1.75 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
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(capstats C CXX)
include(cmake/CommonCMakeConfig.cmake)
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" VERSION LIMIT_COUNT 1)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.cc.in
${CMAKE_CURRENT_BINARY_DIR}/version.cc)
########################################################################
## Dependency Configuration
find_package(PCAP REQUIRED)
include_directories(BEFORE
${PCAP_INCLUDE_DIR}
)
########################################################################
## System Introspection
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(HAVE_LINUX true)
endif ()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
########################################################################
## Build Summary
if (CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} BuildType)
endif ()
message(
"\n=================| capstats Build Summary |==================="
"\n"
"\nInstall prefix: ${CMAKE_INSTALL_PREFIX}"
"\nDebug mode: ${ENABLE_DEBUG}"
"\n"
"\nCXX: ${CMAKE_CXX_COMPILER}"
"\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}"
"\nCPP: ${CMAKE_CXX_COMPILER}"
"\n"
"\n================================================================\n"
)
########################################################################
## capstats target
add_executable(capstats
capstats.cc
${CMAKE_CURRENT_BINARY_DIR}/version.cc)
target_link_libraries(capstats ${PCAP_LIBRARY})
install(TARGETS capstats DESTINATION bin)
include(UserChangedWarning)