-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (64 loc) · 2 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
cmake_minimum_required (VERSION 2.6)
project (write_opentsdb)
include(ExternalProject)
set(VERSION 0.0.6)
option(DEBUG "compile with debug symbol" OFF)
option(LINK_DL "link dl" OFF)
option(LINK_GCC_S "link gcc_s" OFF)
option(LINK_PTHREAD "link pthread" OFF)
IF(LINK_DL)
set(DL_LIBRARIES 'dl')
ENDIF(LINK_DL)
IF(LINK_GCC_S)
set(GCC_S_LIBRARIES 'gcc_s')
ENDIF(LINK_GCC_S)
IF(LINK_PTHREAD)
set(PTHREAD_LIBRARIES 'pthread')
ENDIF(LINK_PTHREAD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700")
if(DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g")
set(CMAKE_BUILD_TYPE Debug)
endif(DEBUG)
add_custom_target(tag
git tag -a "${VERSION}" -m "version ${VERSION}" &&
git push origin ${VERSION}
)
add_custom_target(man ALL)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTSBD_WRITER2_VERSION='\"${VERSION}\"'")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
find_package(CURL REQUIRED)
find_package(collectd REQUIRED)
find_package(JSON-C REQUIRED)
INCLUDE(Pod2Man)
POD2MAN(${CMAKE_CURRENT_SOURCE_DIR}/docs/collectd-opentsdb.pod collectd-opentsdb 5)
MESSAGE(STATUS "Collectd include dir: ${COLLECTD_INCLUDE_DIR}")
MESSAGE(STATUS "Curl include directory: ${CURL_INCLUDE_DIRS}")
MESSAGE(STATUS "Curl library: ${CURL_LIBRARIES}")
MESSAGE(STATUS "Curl version: ${CURL_VERSION_STRING}")
MESSAGE(STATUS "OS Detected: ${CMAKE_SYSTEM_NAME}")
include_directories(
inc/
${CMAKE_INCLUDE_PATH}
${COLLECTD_INCLUDE_DIR}
${COLLECTD_INCLUDE_DIR_BASE}
${CURL_INCLUDE_DIRS}
${JSON-C_INCLUDE_DIRS}
)
add_library(write_opentsdb
"SHARED"
src/write_opentsdb.c
)
ADD_DEFINITIONS(-std=c99)
SET_TARGET_PROPERTIES(write_opentsdb PROPERTIES PREFIX "")
target_link_libraries(write_opentsdb
${CURL_LIBRARIES}
${DL_LIBRARIES}
${GCC_S_LIBRARIES}
${PTHREAD_LIBRARIES}
${JSON-C_LIBRARIES}
)
INSTALL(TARGETS write_opentsdb
LIBRARY DESTINATION lib/collectd
ARCHIVE DESTINATION lib/collectd
)