config: make sure timer is not on the timeouts list before freeing
[project/odhcpd.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8)
2 cmake_policy(SET CMP0015 NEW)
3
4 # Project Definition
5 project(odhcpd C)
6
7 set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
8 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3 -std=gnu99")
9
10 FIND_PATH(ubox_include_dir libubox/uloop.h)
11 FIND_PATH(libnl-tiny_include_dir netlink-generic.h PATH_SUFFIXES libnl-tiny)
12 INCLUDE_DIRECTORIES(${ubox_include_dir} ${libnl-tiny_include_dir})
13
14 FIND_LIBRARY(libnl NAMES nl-tiny)
15
16 add_definitions(-D_GNU_SOURCE -Os -Wall -Werror --std=gnu99)
17 IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
18 add_definitions(-Wextra -Werror=implicit-function-declaration)
19 add_definitions(-Wformat -Werror=format-security -Werror=format-nonliteral)
20 ENDIF()
21 add_definitions(-Wno-unused-parameter -Wmissing-declarations)
22
23
24 if (${EXT_CER_ID})
25 add_definitions(-DEXT_CER_ID=${EXT_CER_ID})
26 endif(${EXT_CER_ID})
27
28 if(${UBUS})
29 add_definitions(-DWITH_UBUS)
30 set(EXT_SRC ${EXT_SRC} src/ubus.c)
31 set(EXT_LINK ${EXT_LINK} ubus)
32 endif(${UBUS})
33
34 if(${DHCPV4_SUPPORT})
35 add_definitions(-DDHCPV4_SUPPORT)
36 set(EXT_SRC ${EXT_SRC} src/dhcpv4.c)
37 endif(${DHCPV4_SUPPORT})
38
39 add_executable(odhcpd src/odhcpd.c src/config.c src/router.c src/dhcpv6.c src/ndp.c src/dhcpv6-ia.c src/netlink.c ${EXT_SRC})
40 target_link_libraries(odhcpd resolv ubox uci ${libnl} ${EXT_LINK})
41
42 # Installation
43 install(TARGETS odhcpd DESTINATION sbin/)
44
45
46 # Packaging information
47 set(CPACK_PACKAGE_VERSION "1")
48 set(CPACK_PACKAGE_CONTACT "Steven Barth <steven@midlink.org>")
49 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "odhcpd")
50 set(CPACK_GENERATOR "DEB;RPM;STGZ")
51 set(CPACK_STRIP_FILES true)
52
53 SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
54 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}")
55
56 include(CPack)
57