-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
114 lines (96 loc) · 3.35 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
cmake_minimum_required(VERSION 2.8)
# This variable are set externally by snap builder
# Set to default for dev build
IF(NOT CMAKE_PROJECT_NAME)
SET(CMAKE_PROJECT_NAME "dnsmasq")
ENDIF(NOT CMAKE_PROJECT_NAME)
IF(NOT CMAKE_PROJECT_CONFIGURATION_DIR)
SET(CMAKE_PROJECT_CONFIGURATION_DIR "/etc/dnsmasq.d/")
ENDIF(NOT CMAKE_PROJECT_CONFIGURATION_DIR)
project(${CMAKE_PROJECT_NAME} C)
set(CMAKE_C_STANDARD 99)
execute_process(COMMAND bld/get-version ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE FULL_VERSION)
set(VERSION_REGEXP "([0-9]+).([0-9]+)rc([0-9]+)-([0-9]+)-([a-z0-9]+)")
string(REGEX REPLACE "${VERSION_REGEXP}" "\\1;\\2;\\3;\\4;\\5" VERSION_LIST ${FULL_VERSION} )
list(GET VERSION_LIST 0 DNSMASQ_VERSION_MAJOR)
list(GET VERSION_LIST 1 DNSMASQ_VERSION_MINOR)
list(GET VERSION_LIST 2 DNSMASQ_VERSION_RCNO)
list(GET VERSION_LIST 3 DNSMASQ_VERSION_PATCH)
list(GET VERSION_LIST 4 DNSMASQ_VERSION_COMMIT)
add_definitions(-DVERSION="${DNSMASQ_VERSION_MAJOR}.${DNSMASQ_VERSION_MINOR}")
message(STATUS "Project Name: ${CMAKE_PROJECT_NAME}")
message(STATUS "Configuration Directory: ${CMAKE_PROJECT_CONFIGURATION_DIR}")
set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}/sbin)
set(CMAKE_INSTALL_SYSCONFDIR ${CMAKE_INSTALL_PREFIX}/etc)
set(CMAKE_INSTALL_MANDIR ${CMAKE_INSTALL_PREFIX}/share/man)
set(CMAKE_INSTALL_LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
set(CMAKE_C_FLAGS "-Wall -W")
set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb")
set(CMAKE_C_FLAGS_RELEASE "-O2")
#find_package(Dbus)
#find_package(idn)
#find_package(idn2)
#find_package(Conntrack)
#find_package(Lua)
#find_package(Nettle)
#find_package(Gmp)
if(CMAKE_SNAP)
add_definitions(-DRUNFILE=NULL)
add_definitions(-DHAVE_SNAP_USER_MANAGER)
endif()
set(SOURCE_FILES
src/arp.c
src/auth.c
src/blockdata.c
src/bpf.c
src/cache.c
src/config.h
src/conntrack.c
src/crypto.c
src/dbus.c
src/dhcp-common.c
src/dhcp-protocol.h
src/dhcp.c
src/dhcp6-protocol.h
src/dhcp6.c
src/dns-protocol.h
src/dnsmasq.c
src/dnsmasq.h
src/dnssec.c
src/domain.c
src/edns0.c
src/forward.c
src/helper.c
src/inotify.c
src/ip6addr.h
src/ipset.c
src/lease.c
src/log.c
src/loop.c
src/netlink.c
src/network.c
src/option.c
src/outpacket.c
src/poll.c
src/radv-protocol.h
src/radv.c
src/rfc1035.c
src/rfc2131.c
src/rfc3315.c
src/rrfilter.c
src/slaac.c
src/tables.c
src/tftp.c
src/util.c)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
configure_file(dnsmasq.conf.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.conf @ONLY )
execute_process(COMMAND sed -i -e "s/#.*$//" ${PROJECT_NAME}.conf WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND sed -i -e "/^$/d" ${PROJECT_NAME}.conf WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.conf
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
install(TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)