1
0
Fork 0
flightgear/CMakeModules/FindLibEvent.cmake

31 lines
893 B
CMake
Raw Normal View History

2019-03-04 21:18:15 +00:00
# Finding LibEvent (https://libevent.org/)
# Defining:
# LIBEVENT_LIB
# LIBEVENT_INCLUDE_DIR
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})
2019-03-04 21:18:15 +00:00
2020-08-19 13:49:50 +00:00
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}"
)
endif()
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)
pkg_check_modules(libEvent QUIET IMPORTED_TARGET libevent)
endif()
if(LIBEVENT_FOUND)
set_target_properties(PkgConfig::libEvent PROPERTIES IMPORTED_GLOBAL TRUE)
# alias the PkgConfig name to standard one
add_library(libEvent ALIAS PkgConfig::libEvent)
endif()
endif(WIN32)