Browse code

c/f:cmake: Fix building with libevent2 (required)

Stefan Sayer authored on 27/02/2014 14:42:47
Showing 3 changed files
... ...
@@ -86,6 +86,8 @@ MESSAGE(STATUS "SEMS doc prefix was set to: ${SEMS_DOC_PREFIX}")
86 86
 
87 87
 SET(CMAKE_VERBOSE_MAKEFILE ON)
88 88
 
89
+FIND_PACKAGE(Libevent2 REQUIRED)
90
+
89 91
 # compile with spandsp DTMF detection? see soft-switch.org
90 92
 #   this needs a fairly new version of spandsp - tested with 0.0.4pre11
91 93
 #   will not work with spandsp 0.0.2 .
92 94
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+FIND_PATH(LIBEVENT2_INCLUDE_DIR event2/event.h HINTS /usr/include/event2 )
2
+FIND_LIBRARY(LIBEVENT2_LIBRARIES NAMES event)
3
+
4
+IF(LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARIES)
5
+	SET(LIBEVENT2_FOUND TRUE)
6
+ENDIF(LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARIES)
7
+
8
+IF(LIBEVENT2_FOUND)
9
+	IF (NOT Libevent2_FIND_QUIETLY)
10
+		MESSAGE(STATUS "Found libevent2 includes:	${LIBEVENT2_INCLUDE_DIR}/event2/event.h")
11
+		MESSAGE(STATUS "Found libevent2 library: ${LIBEVENT2_LIBRARIES}")
12
+	ENDIF (NOT Libevent2_FIND_QUIETLY)
13
+ELSE(LIBEVENT2_FOUND)
14
+	IF (Libevent2_FIND_REQUIRED)
15
+		MESSAGE(FATAL_ERROR "Could NOT find libevent2 development files")
16
+	ENDIF (Libevent2_FIND_REQUIRED)
17
+ENDIF(LIBEVENT2_FOUND)
... ...
@@ -19,6 +19,8 @@ ENDIF(NOT MAX_RTP_SESSIONS)
19 19
 
20 20
 ADD_DEFINITIONS(-DMAX_RTP_SESSIONS=${MAX_RTP_SESSIONS})
21 21
 
22
+TARGET_LINK_LIBRARIES(sems ${CMAKE_DL_LIBS} event event_pthreads)
23
+
22 24
 IF(SPANDSP_FOUND)
23 25
 	TARGET_LINK_LIBRARIES(sems ${CMAKE_DL_LIBS} spandsp)
24 26
 ENDIF(SPANDSP_FOUND)