-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
68 lines (55 loc) · 2.23 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
cmake_minimum_required(VERSION 3.1)
project(libflowtuple C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-files/cmake")
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libflowtuple_BINARY_DIR}/bin)
endif()
#
# Version - read from 'version' file.
#
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/cmake-files/version _version)
string(REGEX REPLACE
"^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]*$" "\\1" _major ${_version})
string(REGEX REPLACE
"^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]*$" "\\1" _minor ${_version})
string(REGEX REPLACE
"^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]*$" "\\1" _revision ${_version})
string(REGEX REPLACE
"^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]*)$" "\\1" _quality ${_version})
set(_version_number ${_major}${_minor}${_revision})
string(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_minor ${_minor})
string(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision})
set(VERSION "${_major}.${_trimmed_minor}.${_trimmed_revision}${_quality}")
set(LIBFLOWTUPLE_VERSION_NUMBER "${_version_number}")
set(LIBFLOWTUPLE_VERSION_STRING "${VERSION}")
option(ENABLE_INSTALL "Enable installing of libraries" ON)
find_library(WANDIO wandio)
if(NOT WANDIO)
message(FATAL_ERROR "libwandio not found")
endif()
include_directories(lib/libflowtuple)
# include(CreatePkgConfigFile)
add_library(flowtuple SHARED
lib/libflowtuple/flowtuple.c
lib/libflowtuple/flowtuple.h
lib/libflowtuple/util.c
lib/libflowtuple/util.h
lib/libflowtuple/fttypes.h
lib/libflowtuple/record.c
lib/libflowtuple/record.h
lib/libflowtuple/class.c
lib/libflowtuple/data.c
lib/libflowtuple/header.c
lib/libflowtuple/interval.c
lib/libflowtuple/trailer.c
lib/libflowtuple/error.c)
target_link_libraries(flowtuple wandio)
add_executable(flow2ascii tools/flow2ascii.c)
target_link_libraries(flow2ascii flowtuple)
add_executable(flowproto tools/flowproto.c)
target_link_libraries(flowproto flowtuple)
install(FILES lib/libflowtuple/flowtuple.h DESTINATION include)
install(TARGETS flowtuple flow2ascii flowproto
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)