1 # - Find LibEvent (a cross event library)
3 # LIBEVENT_INCLUDE_DIR, where to find LibEvent headers
4 # LIBEVENT_LIB, LibEvent libraries
5 # LibEvent_FOUND, If false, do not try to use libevent
7 set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}")
8 foreach(prefix ${LibEvent_EXTRA_PREFIXES})
9 list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include")
10 list(APPEND LibEvent_LIB_PATHS "${prefix}/lib")
13 find_path(LIBEVENT_INCLUDE_DIR event.h PATHS ${LibEvent_INCLUDE_PATHS})
14 find_library(LIBEVENT_LIB NAMES event PATHS ${LibEvent_LIB_PATHS})
15 find_library(LIBEVENT_PTHREAD_LIB NAMES event_pthreads PATHS ${LibEvent_LIB_PATHS})
17 if (LIBEVENT_LIB AND LIBEVENT_INCLUDE_DIR AND LIBEVENT_PTHREAD_LIB)
18 set(LibEvent_FOUND TRUE)
19 set(LIBEVENT_LIB ${LIBEVENT_LIB} ${LIBEVENT_PTHREAD_LIB})
21 set(LibEvent_FOUND FALSE)
25 if (NOT LibEvent_FIND_QUIETLY)
26 message(STATUS "Found libevent: ${LIBEVENT_LIB}")
29 if (LibEvent_FIND_REQUIRED)
30 message(FATAL_ERROR "Could NOT find libevent and libevent_pthread.")
32 message(STATUS "libevent and libevent_pthread NOT found.")