-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
72 lines (52 loc) · 2.03 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
cmake_minimum_required(VERSION 2.8)
project(ohybridproxy C)
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -std=c99")
add_definitions(-D_GNU_SOURCE -Wall -Wextra)
if(${L_LEVEL})
add_definitions(-DL_LEVEL=${L_LEVEL})
endif(${L_LEVEL})
if(${APPLE})
set(dns_sd "")
else(${APPLE})
set(dns_sd "dns_sd")
endif(${APPLE})
FIND_PATH(ubox_include_dir libubox/utils.h)
INCLUDE_DIRECTORIES(${ubox_include_dir})
set(CORE src/cache.c src/io.c src/socket.c)
add_executable(ohybridproxy src/ohybridproxy.c src/dns2mdns.c ${CORE})
target_link_libraries(ohybridproxy ubox ${dns_sd})
add_executable(zonestitcher src/zonestitcher.c src/dns2dns.c ${CORE})
target_link_libraries(zonestitcher ubox)
# Unit test stuff
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
# With this, 'make check' works even in a clean tree (sigh, cmake..)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
enable_testing()
include_directories(src)
#add_executable(test_dummy test/test_dummy.c)
#add_test(dummy test_dummy)
#add_dependencies(check test_dummy)
add_executable(test_dnsutil test/test_dnsutil.c)
add_test(dnsutil test_dnsutil)
add_dependencies(check test_dnsutil)
add_executable(test_dns2mdns test/test_dns2mdns.c)
add_test(dns2mdns test_dns2mdns)
add_dependencies(check test_dns2mdns)
target_link_libraries(test_dns2mdns ubox ${dns_sd})
add_executable(test_mdnsresponder test/test_mdnsresponder.c)
target_link_libraries(test_mdnsresponder ubox ${dns_sd})
add_executable(test_client test/test_client.c)
target_link_libraries(test_client ubox ${dns_sd})
# Installation rules
install(TARGETS ohybridproxy DESTINATION sbin/)
# Packaging rules
set(CPACK_PACKAGE_VERSION "1")
set(CPACK_PACKAGE_CONTACT "Steven Barth <steven@midlink.org>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ohybridproxy")
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)