summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
blob: dd750b3e441af4fe5c3b4a383763e9c39bc5415b (plain)
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
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0015 NEW)

# Project Definition
project(odhcpd C)

set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -std=c99")


add_definitions(-D_GNU_SOURCE -Wall -Werror -Wextra)

if(${EXT_PREFIX_CLASS})
	add_definitions(-DEXT_PREFIX_CLASS=${EXT_PREFIX_CLASS})
endif(${EXT_PREFIX_CLASS})

if (${EXT_CER_ID})
	add_definitions(-DEXT_CER_ID=${EXT_CER_ID})
endif(${EXT_CER_ID})

if(${UBUS})
	add_definitions(-DWITH_UBUS)
	set(EXT_SRC ${EXT_SRC} src/ubus.c)
	set(EXT_LINK ${EXT_LINK} ubus)
endif(${UBUS})

add_executable(odhcpd src/odhcpd.c src/config.c src/router.c src/dhcpv6.c src/ndp.c src/dhcpv6-ia.c src/dhcpv4.c ${EXT_SRC})
target_link_libraries(odhcpd resolv ubox uci ${EXT_LINK})

# Installation
install(TARGETS odhcpd DESTINATION sbin/)


# Packaging information
set(CPACK_PACKAGE_VERSION "1")
set(CPACK_PACKAGE_CONTACT "Steven Barth <steven@midlink.org>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "odhcpd")
set(CPACK_GENERATOR "DEB;RPM;STGZ")
set(CPACK_STRIP_FILES true)

SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}")

include(CPack)