summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 80d1cf5be3524079f166cbb4443bfc45610671fa (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
cmake_minimum_required(VERSION 2.6)

PROJECT(umdns C)
ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)

SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")

SET(SOURCES dns.c announce.c cache.c service.c util.c ubus.c interface.c)

FIND_PATH(ubox_include_dir NAMES libubox/usock.h)
FIND_PATH(ubus_include_dir NAMES libubus.h)
INCLUDE_DIRECTORIES(${ubox_include_dir} ${ubus_include_dir})

FIND_LIBRARY(ubox NAMES ubox)
FIND_LIBRARY(ubus NAMES ubus)
FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
FIND_LIBRARY(json NAMES json json-c)

SET(LIBS ${ubox} ${ubus} ${blobmsg_json} ${json} resolv)

IF(DEBUG)
  ADD_DEFINITIONS(-DDEBUG -g3)
ENDIF()

ADD_LIBRARY(umdns-lib STATIC ${SOURCES})
TARGET_LINK_LIBRARIES(umdns-lib ${LIBS})

ADD_EXECUTABLE(umdns main.c)
TARGET_LINK_LIBRARIES(umdns umdns-lib)

IF(UNIT_TESTING)
  ENABLE_TESTING()
  ADD_SUBDIRECTORY(tests)
ENDIF()

INSTALL(TARGETS umdns
	RUNTIME DESTINATION sbin
)