FindLibev.cmake 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #[=======================================================================[.rst:
  2. FindLibev
  3. ---------
  4. Find the Libev library.
  5. Imported targets
  6. ^^^^^^^^^^^^^^^^
  7. This module defines the following :prop_tgt:`IMPORTED` targets:
  8. ``Libev::Libev``
  9. The Libev library, if found.
  10. Result variables
  11. ^^^^^^^^^^^^^^^^
  12. This module will set the following variables in your project:
  13. ``Libev_FOUND``
  14. If false, do not try to use Libev.
  15. ``LIBEV_INCLUDE_DIR``
  16. where to find libev headers.
  17. ``LIBEV_LIBRARIES``
  18. the libraries needed to use Libev.
  19. ``LIBEV_VERSION``
  20. the version of the Libev library found
  21. #]=======================================================================]
  22. find_path(LIBEV_INCLUDE_DIR ev.h HINTS "${LIBEV_DIR}" "${LIBEV_DIR}/include")
  23. find_library(
  24. LIBEV_LIBRARY
  25. NAMES ev libev
  26. HINTS "${LIBEV_DIR}" "${LIBEV_DIR}/lib"
  27. )
  28. set(LIBEV_LIBRARIES "")
  29. if(LIBEV_INCLUDE_DIR AND LIBEV_LIBRARY)
  30. if(NOT TARGET Libev::Libev)
  31. add_library(Libev::Libev UNKNOWN IMPORTED)
  32. set_target_properties(
  33. Libev::Libev
  34. PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBEV_INCLUDE_DIR}"
  35. IMPORTED_LINK_INTERFACE_LANGUAGES "C"
  36. IMPORTED_LOCATION "${LIBEV_LIBRARY}"
  37. )
  38. endif()
  39. endif()
  40. list(APPEND LIBEV_LIBRARIES "${LIBEV_LIBRARY}")
  41. include(FindPackageHandleStandardArgs)
  42. find_package_handle_standard_args(Libev REQUIRED_VARS LIBEV_LIBRARIES LIBEV_INCLUDE_DIR)
  43. mark_as_advanced(LIBEV_INCLUDE_DIR LIBEV_LIBRARIES LIBEV_LIBRARY)