Module: sems
Branch: master
Commit: dd1e5f69cfde77790ff10c4b2fcd8bf7eaee9aba
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=dd1e5f69cfde77790ff10c4b2fcd8bf7eaee9aba

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Thu Feb 27 15:42:47 2014 +0100

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

---

 CMakeLists.txt            |    2 ++
 cmake/FindLibevent2.cmake |   17 +++++++++++++++++
 core/CMakeLists.txt       |    2 ++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9959d24..def471f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,6 +86,8 @@ MESSAGE(STATUS "SEMS doc prefix was set to: 
${SEMS_DOC_PREFIX}")
 
 SET(CMAKE_VERBOSE_MAKEFILE ON)
 
+FIND_PACKAGE(Libevent2 REQUIRED)
+
 # compile with spandsp DTMF detection? see soft-switch.org
 #   this needs a fairly new version of spandsp - tested with 0.0.4pre11
 #   will not work with spandsp 0.0.2 .
diff --git a/cmake/FindLibevent2.cmake b/cmake/FindLibevent2.cmake
new file mode 100644
index 0000000..c13a038
--- /dev/null
+++ b/cmake/FindLibevent2.cmake
@@ -0,0 +1,17 @@
+FIND_PATH(LIBEVENT2_INCLUDE_DIR event2/event.h HINTS /usr/include/event2 )
+FIND_LIBRARY(LIBEVENT2_LIBRARIES NAMES event)
+
+IF(LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARIES)
+       SET(LIBEVENT2_FOUND TRUE)
+ENDIF(LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARIES)
+
+IF(LIBEVENT2_FOUND)
+       IF (NOT Libevent2_FIND_QUIETLY)
+               MESSAGE(STATUS "Found libevent2 includes:       
${LIBEVENT2_INCLUDE_DIR}/event2/event.h")
+               MESSAGE(STATUS "Found libevent2 library: 
${LIBEVENT2_LIBRARIES}")
+       ENDIF (NOT Libevent2_FIND_QUIETLY)
+ELSE(LIBEVENT2_FOUND)
+       IF (Libevent2_FIND_REQUIRED)
+               MESSAGE(FATAL_ERROR "Could NOT find libevent2 development 
files")
+       ENDIF (Libevent2_FIND_REQUIRED)
+ENDIF(LIBEVENT2_FOUND)
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index bd107c8..fcf41a6 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -19,6 +19,8 @@ ENDIF(NOT MAX_RTP_SESSIONS)
 
 ADD_DEFINITIONS(-DMAX_RTP_SESSIONS=${MAX_RTP_SESSIONS})
 
+TARGET_LINK_LIBRARIES(sems ${CMAKE_DL_LIBS} event event_pthreads)
+
 IF(SPANDSP_FOUND)
        TARGET_LINK_LIBRARIES(sems ${CMAKE_DL_LIBS} spandsp)
 ENDIF(SPANDSP_FOUND)

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to