Roger Meier | 2659381 | 2015-04-12 16:10:35 +0200 | [diff] [blame^] | 1 | # 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 | |
| 9 | set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}") |
| 10 | foreach(prefix ${LibEvent_EXTRA_PREFIXES}) |
| 11 | list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include") |
| 12 | list(APPEND LibEvent_LIBRARIES_PATHS "${prefix}/lib") |
| 13 | endforeach() |
| 14 | |
| 15 | find_path(LIBEVENT_INCLUDE_DIRS event.h PATHS ${LibEvent_INCLUDE_PATHS}) |
| 16 | find_library(LIBEVENT_LIBRARIES NAMES event PATHS ${LibEvent_LIBRARIES_PATHS}) |
| 17 | |
| 18 | if (LIBEVENT_LIBRARIES AND LIBEVENT_INCLUDE_DIRS) |
| 19 | set(Libevent_FOUND TRUE) |
| 20 | set(LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARIES}) |
| 21 | else () |
| 22 | set(Libevent_FOUND FALSE) |
| 23 | endif () |
| 24 | |
| 25 | if (Libevent_FOUND) |
| 26 | if (NOT Libevent_FIND_QUIETLY) |
| 27 | message(STATUS "Found libevent: ${LIBEVENT_LIBRARIES}") |
| 28 | endif () |
| 29 | else () |
| 30 | if (LibEvent_FIND_REQUIRED) |
| 31 | message(FATAL_ERROR "Could NOT find libevent.") |
| 32 | endif () |
| 33 | message(STATUS "libevent NOT found.") |
| 34 | endif () |
| 35 | |
| 36 | mark_as_advanced( |
| 37 | LIBEVENT_LIBRARIES |
| 38 | LIBEVENT_INCLUDE_DIRS |
| 39 | ) |