This repository has been archived by the owner on Jan 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
142 lines (116 loc) · 4.64 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
cmake_minimum_required(VERSION 2.6)
PROJECT(minbif)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules ${CMAKE_MODULE_PATH} )
INCLUDE(FindPkgConfig)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckLibraryExists)
if (DEBUG)
message(STATUS "Configuring for debug")
ADD_DEFINITIONS(-DDEBUG -Werror)
SET(CMAKE_BUILD_TYPE Debug)
else (DEBUG)
message(STATUS "Configuring for release")
SET(CMAKE_BUILD_TYPE Release)
endif (DEBUG)
PKG_CHECK_MODULES(PURPLE REQUIRED purple>=2.5)
IF(NOT PURPLE_FOUND)
MESSAGE(FATAL_ERROR "Please install the purple library (version >=2.5).")
ENDIF(NOT PURPLE_FOUND)
OPTION(ENABLE_MINBIF "Enable minbif compilation" ON)
IF(ENABLE_MINBIF)
PKG_CHECK_MODULES(GTHREAD REQUIRED gthread-2.0)
OPTION(ENABLE_IMLIB "Use imlib library" ON)
IF(ENABLE_IMLIB)
PKG_CHECK_MODULES(IMLIB imlib2>=1.0)
IF(IMLIB_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_IMLIB")
INCLUDE(FindX11)
IF(NOT X11_FOUND)
ADD_DEFINITIONS(-DX_DISPLAY_MISSING)
ENDIF(NOT X11_FOUND)
ELSE(IMLIB_FOUND)
MESSAGE(FATAL_ERROR "Unable to find the imlib2 library. To disable use of imlib2, run 'make ENABLE_IMLIB=OFF'")
ENDIF(IMLIB_FOUND)
ENDIF(ENABLE_IMLIB)
OPTION(ENABLE_CACA "Enable libcaca library" ON)
IF(ENABLE_CACA)
IF(NOT ENABLE_IMLIB)
MESSAGE(FATAL_ERROR "You need to enable IMLIB to enable CACA")
ENDIF(NOT ENABLE_IMLIB)
PKG_CHECK_MODULES(CACA caca>=0.99)
IF(CACA_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_CACA")
ELSE(CACA_FOUND)
MESSAGE(FATAL_ERROR "Unable to find the libcaca library. To disable caca output, run 'make ENABLE_CACA=OFF'")
ENDIF(CACA_FOUND)
PKG_CHECK_MODULES(NEWCACA caca>=0.99.beta17)
IF(NOT NEWCACA_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_OLD_CACA")
ENDIF(NOT NEWCACA_FOUND)
ENDIF(ENABLE_CACA)
OPTION(ENABLE_VIDEO "Enable video support" ON)
IF(ENABLE_VIDEO)
IF(NOT ENABLE_CACA)
MESSAGE(FATAL_ERROR "You need to enable CACA to enable VIDEO")
ENDIF(NOT ENABLE_CACA)
PKG_CHECK_MODULES(GSTREAMER gstreamer-0.10>=0.10.10 gstreamer-interfaces-0.10>=0.10)
PKG_CHECK_MODULES(FARSIGHT farsight2-0.10>=0.0.9)
PKG_CHECK_MODULES(PURPLE_26 purple>=2.6.1)
IF(GSTREAMER_FOUND AND PURPLE_26_FOUND AND FARSIGHT_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_VIDEO")
ELSE(GSTREAMER_FOUND AND PURPLE_26_FOUND AND FARSIGHT_FOUND)
MESSAGE(FATAL_ERROR "Dependencies for video were not met. Install gstreamer, farsight and libpurple>=2.6 first. Or to disable video, run 'make ENABLE_VIDEO=0'")
ENDIF(GSTREAMER_FOUND AND PURPLE_26_FOUND AND FARSIGHT_FOUND)
ENDIF(ENABLE_VIDEO)
OPTION(ENABLE_PAM "Enable PAM support" ON)
IF (ENABLE_PAM)
find_package(PAM)
IF (PAM_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_PAM")
ELSE (PAM_FOUND)
MESSAGE(FATAL_ERROR "Dependencies for PAM were not met. Install libpam-dev. Or to disable PAM support, run 'make ENABLE_PAM=0'")
ENDIF (PAM_FOUND)
ENDIF (ENABLE_PAM)
OPTION(ENABLE_TLS "Enable TLS support" ON)
IF (ENABLE_TLS)
PKG_CHECK_MODULES(GNUTLS REQUIRED "gnutls")
IF (GNUTLS_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_TLS")
ENDIF (GNUTLS_FOUND)
ENDIF (ENABLE_TLS)
SET(CONF_NAME minbif.conf)
SET(MOTD_NAME minbif.motd)
IF(NOT MAN_PREFIX)
SET(MAN_PREFIX ${CMAKE_INSTALL_PREFIX}/share/man/man8/)
ENDIF(NOT MAN_PREFIX)
IF(NOT CONF_PREFIX)
SET(CONF_PREFIX ${CMAKE_INSTALL_PREFIX}/etc/minbif)
ENDIF(NOT CONF_PREFIX)
IF(NOT DOC_PREFIX)
SET(DOC_PREFIX ${CMAKE_INSTALL_PREFIX}/share/doc/minbif)
ENDIF(NOT DOC_PREFIX)
INSTALL(FILES man/minbif.8
DESTINATION ${MAN_PREFIX})
INSTALL(FILES COPYING README
DESTINATION ${DOC_PREFIX})
INSTALL(DIRECTORY doc/
DESTINATION ${DOC_PREFIX})
INSTALL(FILES ${CONF_NAME} ${MOTD_NAME}
DESTINATION ${CONF_PREFIX})
ENDIF(ENABLE_MINBIF)
OPTION(ENABLE_PLUGIN "Enable plugin build" OFF)
IF(ENABLE_PLUGIN)
PKG_CHECK_MODULES(LIBXML REQUIRED libxml-2.0>=2.5)
ENDIF(ENABLE_PLUGIN)
INCLUDE_DIRECTORIES(${PURPLE_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS} ${CACA_INCLUDE_DIRS} ${IMLIB_INCLUDE_DIRS} ${GSTREAMER_INCLUDE_DIRS} ${FARSIGHT_INCLUDE_DIRS} ${LIBXML_INCLUDE_DIRS} ${PAM_INCLUDE_DIRS} ${GNUTLS_INCLUDE_DIRS} "src/")
LINK_DIRECTORIES(${PURPLE_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS} ${CACA_LIBRARY_DIRS} ${IMLIB_LIBRARY_DIRS} ${GSTREAMER_LIBRARY_DIRS} ${FARSIGHT_LIBRARY_DIRS} ${LIBXML_LIBRARY_DIRS} ${GNUTLS_LIBRARY_DIRS})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_REENTRANT -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-parameter")
SET(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
IF(ENABLE_MINBIF)
add_subdirectory(src)
ENDIF(ENABLE_MINBIF)
IF(ENABLE_PLUGIN)
add_subdirectory(plugins)
ENDIF(ENABLE_PLUGIN)
MESSAGE(STATUS "Using compiler ${CMAKE_CXX_COMPILER}")
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")