1 cmake_minimum_required(VERSION 2.6) 2 3 PROJECT(umdns C) 4 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations) 5 6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") 7 8 SET(SOURCES dns.c announce.c cache.c service.c util.c ubus.c interface.c) 9 10 FIND_PATH(ubox_include_dir NAMES libubox/usock.h) 11 FIND_PATH(ubus_include_dir NAMES libubus.h) 12 FIND_PATH(udebug_include_dir NAMES udebug.h) 13 INCLUDE_DIRECTORIES(${ubox_include_dir} ${ubus_include_dir} ${udebug_include_dir}) 14 15 FIND_LIBRARY(ubox NAMES ubox) 16 FIND_LIBRARY(ubus NAMES ubus) 17 FIND_LIBRARY(blobmsg_json NAMES blobmsg_json) 18 FIND_LIBRARY(json NAMES json json-c) 19 FIND_LIBRARY(udebug NAMES udebug) 20 21 SET(LIBS ${ubox} ${ubus} ${blobmsg_json} ${json} resolv ${udebug}) 22 23 IF(DEBUG) 24 ADD_DEFINITIONS(-DDEBUG -g3) 25 ENDIF() 26 27 ADD_LIBRARY(umdns-lib STATIC ${SOURCES}) 28 TARGET_LINK_LIBRARIES(umdns-lib ${LIBS}) 29 30 ADD_EXECUTABLE(umdns main.c) 31 TARGET_LINK_LIBRARIES(umdns umdns-lib) 32 33 IF(UNIT_TESTING) 34 ENABLE_TESTING() 35 ADD_SUBDIRECTORY(tests) 36 37 IF(CMAKE_C_COMPILER_ID STREQUAL "Clang") 38 ADD_LIBRARY(umdns-lib-san STATIC ${SOURCES}) 39 TARGET_COMPILE_OPTIONS(umdns-lib-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all) 40 TARGET_LINK_OPTIONS(umdns-lib-san PRIVATE -fsanitize=undefined,address,leak) 41 TARGET_LINK_LIBRARIES(umdns-lib-san ${LIBS}) 42 43 ADD_EXECUTABLE(umdns-san main.c ${SOURCES}) 44 TARGET_COMPILE_OPTIONS(umdns-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all) 45 TARGET_LINK_OPTIONS(umdns-san PRIVATE -fsanitize=undefined,address,leak) 46 TARGET_LINK_LIBRARIES(umdns-san umdns-lib-san) 47 ENDIF() 48 49 ENDIF() 50 51 INSTALL(TARGETS umdns 52 RUNTIME DESTINATION sbin 53 )
This page was automatically generated by LXR 0.3.1. • OpenWrt