-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (66 loc) · 2.84 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
cmake_minimum_required(VERSION 2.6)
project(SynFlood)
set(PROJECT_VERSION_MAJOR 2)
set(PROJECT_VERSION_MINOR 1)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_COPYRIGHT "Copyright (C) 2010 Christian Mayer <http://fox21.at>")
set(DEBUG 1)
set(SRC_PORT_RND 0)
set(EXIT_ON_FAIL 0)
set(PROJECT_DEFINE_TTL 255)
set(PROJECT_DEFINE_USLEEP 250)
set(PROJECT_DEFINE_ARGC_MIN 4)
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
execute_process(COMMAND libnet-config --defines OUTPUT_VARIABLE LIBNET_DEFINES OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND libnet-config --cflags OUTPUT_VARIABLE LIBNET_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND libnet-config --libs OUTPUT_VARIABLE LIBNET_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
if(SRC_PORT_RND)
set(PROJECT_DEFINE_SRC_PORT_RND "#define SRC_PORT_RND")
endif()
if(EXIT_ON_FAIL)
set(PROJECT_DEFINE_EXIT_ON_FAIL "#define EXIT_ON_FAIL")
endif()
configure_file("${PROJECT_SOURCE_DIR}/src/config.h.in" "${PROJECT_BINARY_DIR}/src/config.h")
file(GLOB_RECURSE PROJECT_SOURCES "src/*.c")
find_path(STDIO_INCLUDE_PATH stdio.h)
find_path(LIBNET_INCLUDE_PATH libnet.h)
set(PROJECT_INCLUDE_DIRS "")
foreach(_srcFile ${PROJECT_SOURCES})
get_filename_component(_dir ${_srcFile} PATH)
list(APPEND PROJECT_INCLUDE_DIRS ${_dir})
endforeach()
list(REMOVE_DUPLICATES PROJECT_INCLUDE_DIRS)
include_directories(${PROJECT_INCLUDE_DIRS})
include_directories("${PROJECT_BINARY_DIR}/src")
include_directories(${STDIO_INCLUDE_PATH})
include_directories(${LIBNET_INCLUDE_PATH})
add_executable(synflood ${PROJECT_SOURCES})
target_link_libraries(synflood ${LIBNET_LIBS})
add_executable(synflood_test tests/synflood_test.c)
target_link_libraries(synflood_test ${LIBNET_LIBS})
enable_testing()
add_test(NAME StdRuns COMMAND synflood)
set_tests_properties(StdRuns PROPERTIES WILL_FAIL true)
add_test(NAME TestRuns COMMAND synflood_test)
MESSAGE("")
MESSAGE(STATUS "PROJECT_NAME: ${PROJECT_NAME}")
MESSAGE(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
MESSAGE(STATUS "PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}")
MESSAGE(STATUS "PROJECT_SOURCES: ${PROJECT_SOURCES}")
MESSAGE(STATUS "PROJECT_INCLUDE_DIRS: ${PROJECT_INCLUDE_DIRS}")
MESSAGE("")
MESSAGE(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
MESSAGE(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
MESSAGE(STATUS "CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
MESSAGE(STATUS "CMAKE_INCLUDE_PATH: ${CMAKE_INCLUDE_PATH}")
MESSAGE(STATUS "CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}")
MESSAGE(STATUS "STDIO_INCLUDE_PATH: ${STDIO_INCLUDE_PATH}")
MESSAGE("")
MESSAGE(STATUS "LIBNET_DEFINES: ${LIBNET_DEFINES}")
MESSAGE(STATUS "LIBNET_CFLAGS: ${LIBNET_CFLAGS}")
MESSAGE(STATUS "LIBNET_LIBS: ${LIBNET_LIBS}")
MESSAGE(STATUS "LIBNET_INCLUDE_PATH: ${LIBNET_INCLUDE_PATH}")
MESSAGE("")