Fix some copyright lines in folly/detail/ and folly/test/
[folly.git] / CMake / FindLibEvent.cmake
1 # - Find LibEvent (a cross event library)
2 # This module defines
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
6
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")
11 endforeach()
12
13 find_path(LIBEVENT_INCLUDE_DIR event.h PATHS ${LibEvent_INCLUDE_PATHS})
14 find_library(LIBEVENT_LIB NAMES event PATHS ${LibEvent_LIB_PATHS})
15
16 if (LIBEVENT_LIB AND LIBEVENT_INCLUDE_DIR)
17   set(LibEvent_FOUND TRUE)
18   set(LIBEVENT_LIB ${LIBEVENT_LIB})
19 else ()
20   set(LibEvent_FOUND FALSE)
21 endif ()
22
23 if (LibEvent_FOUND)
24   if (NOT LibEvent_FIND_QUIETLY)
25     message(STATUS "Found libevent: ${LIBEVENT_LIB}")
26   endif ()
27 else ()
28   if (LibEvent_FIND_REQUIRED)
29     message(FATAL_ERROR "Could NOT find libevent.")
30   endif ()
31   message(STATUS "libevent NOT found.")
32 endif ()
33
34 mark_as_advanced(
35     LIBEVENT_LIB
36     LIBEVENT_INCLUDE_DIR
37   )