blob: 1eac31558c3c0b97d567e919384652cf2cbff255 [file] [log] [blame]
Roger Meier26593812015-04-12 16:10:35 +02001# find LibEvent
2# an event notification library (http://libevent.org/)
3#
4# Usage:
5# LIBEVENT_INCLUDE_DIRS, where to find LibEvent headers
6# LIBEVENT_LIBRARIES, LibEvent libraries
7# Libevent_FOUND, If false, do not try to use libevent
8
9set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}")
10foreach(prefix ${LibEvent_EXTRA_PREFIXES})
11 list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include")
12 list(APPEND LibEvent_LIBRARIES_PATHS "${prefix}/lib")
13endforeach()
14
15find_path(LIBEVENT_INCLUDE_DIRS event.h PATHS ${LibEvent_INCLUDE_PATHS})
16find_library(LIBEVENT_LIBRARIES NAMES event PATHS ${LibEvent_LIBRARIES_PATHS})
17
18if (LIBEVENT_LIBRARIES AND LIBEVENT_INCLUDE_DIRS)
19 set(Libevent_FOUND TRUE)
20 set(LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARIES})
21else ()
22 set(Libevent_FOUND FALSE)
23endif ()
24
25if (Libevent_FOUND)
26 if (NOT Libevent_FIND_QUIETLY)
27 message(STATUS "Found libevent: ${LIBEVENT_LIBRARIES}")
28 endif ()
29else ()
30 if (LibEvent_FIND_REQUIRED)
31 message(FATAL_ERROR "Could NOT find libevent.")
32 endif ()
33 message(STATUS "libevent NOT found.")
34endif ()
35
36mark_as_advanced(
37 LIBEVENT_LIBRARIES
38 LIBEVENT_INCLUDE_DIRS
39 )