2019-03-04 21:18:15 +00:00
|
|
|
# Finding LibEvent (https://libevent.org/)
|
|
|
|
# Defining:
|
|
|
|
# LIBEVENT_LIB
|
|
|
|
# LIBEVENT_INCLUDE_DIR
|
|
|
|
|
2020-08-27 21:33:08 +00:00
|
|
|
set(libEvent_target "_no_target_")
|
|
|
|
|
2020-08-19 13:49:50 +00:00
|
|
|
if(WIN32)
|
|
|
|
FIND_PATH(LIBEVENT_INCLUDE_DIR event2/event.h PATH_SUFFIXES include HINTS ${ADDITIONAL_LIBRARY_PATHS})
|
|
|
|
FIND_LIBRARY(LIBEVENT_LIB NAMES event_core PATH_SUFFIXES lib HINTS ${ADDITIONAL_LIBRARY_PATHS})
|
|
|
|
if (LIBEVENT_INCLUDE_DIR AND LIBEVENT_LIB)
|
|
|
|
add_library(libEvent UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(libEvent PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT_INCLUDE_DIR}"
|
|
|
|
IMPORTED_LOCATION "${LIBEVENT_LIB}"
|
|
|
|
)
|
2020-10-29 20:46:29 +00:00
|
|
|
set(libEvent_target "libEvent")
|
2020-08-19 13:49:50 +00:00
|
|
|
endif()
|
2020-08-27 21:33:08 +00:00
|
|
|
|
|
|
|
|
2020-08-19 13:49:50 +00:00
|
|
|
else()
|
|
|
|
find_package(PkgConfig QUIET)
|
2019-05-17 08:19:35 +00:00
|
|
|
|
2020-08-19 13:49:50 +00:00
|
|
|
if(PKG_CONFIG_FOUND)
|
2020-08-27 21:33:08 +00:00
|
|
|
pkg_check_modules(libEvent IMPORTED_TARGET libevent)
|
2020-08-19 13:49:50 +00:00
|
|
|
endif()
|
|
|
|
|
2020-08-23 10:28:59 +00:00
|
|
|
if(libEvent_FOUND)
|
2020-08-27 21:33:08 +00:00
|
|
|
# can't use an ALIAS here, needs CMake 3.11
|
|
|
|
# use a global property instead
|
|
|
|
set(libEvent_target "PkgConfig::libEvent")
|
2020-08-19 13:49:50 +00:00
|
|
|
endif()
|
|
|
|
endif(WIN32)
|