Adapted unit test to new return value on --help.
[dabba.git] / CMakeLists.txt
blob7e922c5929af45f2dbe00aa88490e7ff1fcc11e4
1 PROJECT(dabba C)
3 # States that CMake required version must be >= 2.6
4 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
6 SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
7 # Activate this when you want to build a shared lib out the the lib/ directory
8 # Bear in mind that no profiling will be available on 64-bit arch when on
9 # SET(BUILD_SHARED_LIBS ON)
11 FIND_PACKAGE(Threads REQUIRED)
13 IF(CMAKE_HAVE_PTHREAD_CREATE)
14         SET(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
15 ELSE(CMAKE_HAVE_PTHREAD_CREATE)
16         MESSAGE(FATAL_ERROR "The framework only supports pthread")
17 ENDIF(CMAKE_HAVE_PTHREAD_CREATE)
19 INCLUDE(CheckBPFAttach)
20 INCLUDE(CheckPFPacket)
21 INCLUDE(CheckStrictAlign)
22 INCLUDE(CheckTxRing)
24 ADD_DEFINITIONS(
25         -W
26         -Wextra
27         -Wall
28         -Werror
29         -std=gnu99
30         -O2
31         -D_REENTRANT
32         -D_FORTIFY_SOURCE=2
33         -fstack-protector
36 # Only strip executable on release
37 SET(CMAKE_C_FLAGS_RELEASE "-s")
39 IF(CMAKE_C_COMPILER_ID STREQUAL GNU)
40         ADD_DEFINITIONS(
41                 -pedantic
42                 -pedantic-errors
43                 -z relo
44                 -pie
45         )
46 ENDIF(CMAKE_C_COMPILER_ID STREQUAL GNU)
48 IF (CMAKE_BUILD_TYPE STREQUAL profile)
49         ADD_DEFINITIONS(-g -pg)
50 ENDIF (CMAKE_BUILD_TYPE STREQUAL profile)
52 ENABLE_TESTING()
54 ADD_CUSTOM_TARGET(setcap)
55 ADD_CUSTOM_TARGET(doc)
57 ADD_SUBDIRECTORY(libdabba)
58 ADD_SUBDIRECTORY(dabbad)
59 ADD_SUBDIRECTORY(dabba)