-
Notifications
You must be signed in to change notification settings - Fork 21
/
CMakeLists.txt
74 lines (60 loc) · 2.18 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(PROJECT_NAME_STR commotion)
PROJECT(${PROJECT_NAME_STR})
SET(NO_OPTIMIZE OFF CACHE BOOL "Disable optimization flags.")
SET(DEBUG OFF CACHE BOOL "Turn on debugging.")
SET(OPENWRT OFF CACHE BOOL "Disable subsystems that are unnecessary for OpenWRT platform.")
SET(TEST ON CACHE BOOL "Build unit tests.")
SET(PLUGINS ON CACHE BOOL "Build plugins.")
SET(COMMOTION_VERSION_MAJOR 0)
SET(COMMOTION_VERSION_MINOR 1)
SET(COMMOTION_VERSION_PATCH 0)
SET(COMMOTION_CONFIGFILE \"/etc/commotion/commotiond.conf\")
SET(COMMOTION_STATEDIR \"/var/run/commotion\")
SET(COMMOTION_PIDFILE \"/var/run/commotiond.pid\")
SET(COMMOTION_MANAGESOCK \"/var/run/commotiond.sock\")
SET(COMMOTION_PLUGINDIR \"/usr/lib/commotion/plugins\")
SET(COMMOTION_PROFILEDIR \"/etc/commotion/profiles.d\")
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(COMMON_INCLUDES ${PROJECT_SOURCE_DIR}/src)
CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/src/config.h.in" "${CMAKE_SOURCE_DIR}/src/config.h" )
ADD_DEFINITIONS(-Os -Wall --std=gnu99 -Wmissing-declarations -DNDEBUG)
IF(OPENWRT)
ADD_DEFINITIONS(-D_OPENWRT -DUSESYSLOG)
ENDIF()
IF(DEBUG)
ADD_DEFINITIONS(-g3)
REMOVE_DEFINITIONS(-DNDEBUG)
IF(NO_OPTIMIZE)
REMOVE_DEFINITIONS(-Os)
ADD_DEFINITIONS(-O0)
ENDIF()
ENDIF()
ADD_SUBDIRECTORY(src)
IF(TEST)
ENABLE_TESTING()
ADD_SUBDIRECTORY(tests)
ENDIF()
IF(PLUGINS)
ADD_SUBDIRECTORY(plugins)
ENDIF()
IF(NOT OPENWRT)
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
ADD_CUSTOM_TARGET(doc ALL
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
ENDIF(DOXYGEN_FOUND)
ENDIF()
INSTALL(FILES files/commotiond.conf DESTINATION /etc/commotion)
INSTALL(DIRECTORY files/profiles.d DESTINATION /etc/commotion)
# uninstall target
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)