diff options
Diffstat (limited to 'contrib/cmake/FindLibEvent.cmake')
-rw-r--r-- | contrib/cmake/FindLibEvent.cmake | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/contrib/cmake/FindLibEvent.cmake b/contrib/cmake/FindLibEvent.cmake new file mode 100644 index 0000000..47872fe --- /dev/null +++ b/contrib/cmake/FindLibEvent.cmake @@ -0,0 +1,83 @@ +FIND_PATH(LIBEVENT_INCLUDE_DIR event2/event.h + PATH_SUFFIXES include + PATHS + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + HINTS $ENV{LIBEVENT_SRC} +) + +FIND_LIBRARY(LIBEVENT_LIBRARY_RELEASE + NAMES event libevent + HINTS $ENV{LIBEVENT_SRC}/.libs/ +) +if (LIBEVENT_LIBRARY_RELEASE) + list(APPEND LIBEVENT_LIBRARIES optimized ${LIBEVENT_LIBRARY_RELEASE}) +endif() + +FIND_LIBRARY(LIBEVENT_LIBRARY_DEBUG + NAMES event_d libevent_d + HINTS $ENV{LIBEVENT_SRC}/.libs/ +) +if (LIBEVENT_LIBRARY_DEBUG) + list(APPEND LIBEVENT_LIBRARIES debug ${LIBEVENT_LIBRARY_DEBUG}) +else() + if (LIBEVENT_LIBRARY_RELEASE) + list(APPEND LIBEVENT_LIBRARIES debug ${LIBEVENT_LIBRARY_RELEASE}) + endif() +endif() + + + +FIND_LIBRARY(LIBEVENT_SSL_LIBRARY_RELEASE + NAMES event_openssl libevent_openssl + HINTS $ENV{LIBEVENT_SRC}/.libs/ +) +if (LIBEVENT_SSL_LIBRARY_RELEASE) + list(APPEND LIBEVENT_LIBRARIES optimized ${LIBEVENT_SSL_LIBRARY_RELEASE}) + SET(LIBEVENT_SSL_FOUND ON) +endif() + +FIND_LIBRARY(LIBEVENT_SSL_LIBRARY_DEBUG + NAMES event_openssl_d libevent_openssl_d + HINTS $ENV{LIBEVENT_SRC}/.libs/ +) +if (LIBEVENT_SSL_LIBRARY_DEBUG) + list(APPEND LIBEVENT_LIBRARIES debug ${LIBEVENT_SSL_LIBRARY_DEBUG}) +else() + if (LIBEVENT_SSL_LIBRARY_RELEASE) + list(APPEND LIBEVENT_LIBRARIES debug ${LIBEVENT_SSL_LIBRARY_RELEASE}) + endif() +endif() + + + +if (NOT WIN32) + FIND_LIBRARY(LIBEVENT_LIBRARY_THREADS + NAMES event_pthreads + HINTS $ENV{EVENT_SRC}/.libs/ + ) + list (APPEND LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARY_THREADS}) + + FIND_LIBRARY(LIBEVENT_LIBRARY_EXTRA + NAMES event_extra + HINTS $ENV{LIBEVENT_SRC}/.libs/ + ) + list (APPEND LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARY_EXTRA}) + + FIND_LIBRARY(LIBEVENT_LIBRARY_CORE + NAMES event_core + HINTS $ENV{EVENT_SRC}/.libs/ + ) + list (APPEND LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARY_CORE}) + +endif() + +#message(FATAL_ERROR "EVENT_SSL_FOUND: ${EVENT_SSL_FOUND}") + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBEVENT DEFAULT_MSG LIBEVENT_LIBRARIES LIBEVENT_INCLUDE_DIR) +MARK_AS_ADVANCED(LIBEVENT_LIBRARIES LIBEVENT_INCLUDE_DIR LIBEVENT_SSL_FOUND) |