-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
70 lines (56 loc) · 2.13 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
PROJECT(librdns C)
SET(RDNS_VERSION_MAJOR 0)
SET(RDNS_VERSION_MINOR 1)
SET(RDNS_VERSION_PATCH 1)
IF(NOT SLAVE_BUILD)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
ELSE(NOT SLAVE_BUILD)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
ENDIF(NOT SLAVE_BUILD)
OPTION(ENABLE_CURVE "Enable DNSCurve plugin" ON)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckSymbolExists)
SET(LIBRDNSSRC src/util.c
src/logger.c
src/compression.c
src/punycode.c
src/curve.c
src/parse.c
src/packet.c
src/resolver.c)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/src"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_BINARY_DIR}/src"
"${CMAKE_BINARY_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/uthash"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/libottery"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/tweetnacl")
IF(NOT SLAVE_BUILD)
CHECK_SYMBOL_EXISTS(IPV6_V6ONLY "sys/socket.h;netinet/in.h" HAVE_IPV6_V6ONLY)
CHECK_SYMBOL_EXISTS(getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
IF(NOT HAVE_GETADDRINFO)
MESSAGE(FATAL_ERROR "Your system does not support getaddrinfo call, please consider upgrading it to run librdns")
ENDIF(NOT HAVE_GETADDRINFO)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
IF(ENABLE_CURVE MATCHES "ON")
ADD_SUBDIRECTORY(contrib/tweetnacl)
INCLUDE_DIRECTORIES("contrib/tweetnacl")
SET(TWEETNACL 1)
ADD_DEFINITIONS("-DTWEETNACL")
ENDIF(ENABLE_CURVE MATCHES "ON")
ADD_SUBDIRECTORY(contrib/libottery)
ADD_SUBDIRECTORY(test)
ADD_LIBRARY(rdns_core OBJECT ${LIBRDNSSRC})
SET_TARGET_PROPERTIES(rdns_core PROPERTIES COMPILE_FLAGS "-fPIC")
SET(DLIBS "$<TARGET_OBJECTS:ottery>")
IF(ENABLE_CURVE MATCHES "ON")
LIST(APPEND DLIBS "$<TARGET_OBJECTS:tweetnacl>")
ENDIF(ENABLE_CURVE MATCHES "ON")
ADD_LIBRARY(rdns_static STATIC $<TARGET_OBJECTS:rdns_core> ${DLIBS})
ADD_LIBRARY(rdns SHARED $<TARGET_OBJECTS:rdns_core> ${DLIBS})
SET_TARGET_PROPERTIES(rdns PROPERTIES
VERSION ${RDNS_VERSION_MAJOR}.${RDNS_VERSION_MINOR}.${RDNS_VERSION_PATCH}
SOVERSION ${RDNS_VERSION_MINOR})
ELSE(NOT SLAVE_BUILD)
ADD_LIBRARY(rdns STATIC ${LIBRDNSSRC})
ENDIF(NOT SLAVE_BUILD)