summaryrefslogtreecommitdiff
path: root/cmake/FindLibEV.cmake
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2010-08-07 10:46:34 +0000
committerStefan Bühler <stbuehler@web.de>2010-08-07 10:46:34 +0000
commitf8eb52ebdac82e752f9f755ce79b0f88bac613cf (patch)
tree1fe00fb2de1b0a008b70b385338e8b28b0f4a75a /cmake/FindLibEV.cmake
parent4ae13c32b165289becfbcee013cf9dc3999c9b83 (diff)
downloadlighttpd-git-f8eb52ebdac82e752f9f755ce79b0f88bac613cf.tar.gz
add libev fdevent handler: server.event-handler = "libev"
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2754 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'cmake/FindLibEV.cmake')
-rw-r--r--cmake/FindLibEV.cmake70
1 files changed, 70 insertions, 0 deletions
diff --git a/cmake/FindLibEV.cmake b/cmake/FindLibEV.cmake
new file mode 100644
index 00000000..204725d7
--- /dev/null
+++ b/cmake/FindLibEV.cmake
@@ -0,0 +1,70 @@
+
+SET(LIBEV_PATH "" CACHE PATH "Base path for include/ev.h and lib/libev*")
+SET(LIBEV_INCLUDE_PATH "" CACHE PATH "Include path for ev.h")
+SET(LIBEV_LIBDIR "" CACHE PATH "Path containing libev")
+
+IF(LIBEV_PATH)
+ SET(LIBEV_INCLUDE_PATH "${LIBEV_PATH}/include" CACHE PATH "Include path for ev.h" FORCE)
+ SET(LIBEV_LIBDIR "${LIBEV_PATH}/lib" CACHE PATH "Path containing libev" FORCE)
+ENDIF(LIBEV_PATH)
+
+IF(LIBEV_INCLUDE_PATH)
+ INCLUDE_DIRECTORIES(${LIBEV_INCLUDE_PATH})
+ENDIF(LIBEV_INCLUDE_PATH)
+
+# Use cached result
+IF(NOT LIBEV_FOUND)
+ UNSET(HAVE_EV_H)
+ UNSET(HAVE_LIBEV)
+ UNSET(HAVE_EV_H CACHE)
+ UNSET(HAVE_LIBEV CACHE)
+ UNSET(LIBEV_CFLAGS)
+ UNSET(LIBEV_LDFLAGS)
+
+ IF(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
+ SET(CMAKE_REQUIRED_INCLUDES ${LIBEV_INCLUDE_PATH})
+# MESSAGE(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}")
+ CHECK_INCLUDE_FILES(ev.h HAVE_EV_H)
+ IF(HAVE_EV_H)
+# MESSAGE(STATUS "Looking for lib ev in ${LIBEV_LIBDIR}")
+ CHECK_LIBRARY_EXISTS(ev ev_loop "${LIBEV_LIBDIR}" HAVE_LIBEV)
+ IF(HAVE_LIBEV)
+ SET(LIBEV_CFLAGS "" CACHE INTERNAL "")
+ SET(LIBEV_LDFLAGS "-L${LIBEV_LIBDIR} -lev" CACHE INTERNAL "")
+ SET(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE)
+ ELSE(HAVE_LIBEV)
+ MESSAGE(STATUS "Couldn't find lib ev in ${LIBEV_LIBDIR}")
+ ENDIF(HAVE_LIBEV)
+ ELSE(HAVE_EV_H)
+ MESSAGE(STATUS "Couldn't find <ev.h> in ${LIBEV_INCLUDE_PATH}")
+ ENDIF(HAVE_EV_H)
+ ELSE(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
+ pkg_check_modules(LIBEV libev)
+ IF(NOT LIBEV_FOUND)
+# MESSAGE(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}")
+ CHECK_INCLUDE_FILES(ev.h HAVE_EV_H)
+ IF(HAVE_EV_H)
+# MESSAGE(STATUS "Looking for lib ev")
+ CHECK_LIBRARY_EXISTS(ev ev_loop "" HAVE_LIBEV)
+ IF(HAVE_LIBEV)
+ SET(LIBEV_CFLAGS "" CACHE INTERNAL "")
+ SET(LIBEV_LDFLAGS "-lev" CACHE INTERNAL "")
+ SET(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE)
+ ELSE(HAVE_LIBEV)
+ MESSAGE(STATUS "Couldn't find lib ev")
+ ENDIF(HAVE_LIBEV)
+ ELSE(HAVE_EV_H)
+ MESSAGE(STATUS "Couldn't find <ev.h>")
+ ENDIF(HAVE_EV_H)
+ ENDIF(NOT LIBEV_FOUND)
+ ENDIF(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
+
+ENDIF(NOT LIBEV_FOUND)
+
+IF(NOT LIBEV_FOUND)
+ IF(LibEV_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find libev")
+ ENDIF(LibEV_FIND_REQUIRED)
+ENDIF(NOT LIBEV_FOUND)
+
+MARK_AS_ADVANCED(LIBEV_PATH LIBEV_INCLUDE_PATH LIBEV_LIBDIR)