You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.5 KiB

  1. SET(LIBEV_PATH "" CACHE PATH "Base path for include/ev.h and lib/libev*")
  2. SET(LIBEV_INCLUDE_PATH "" CACHE PATH "Include path for ev.h")
  3. SET(LIBEV_LIBDIR "" CACHE PATH "Path containing libev")
  4. IF(LIBEV_PATH)
  5. SET(LIBEV_INCLUDE_PATH "${LIBEV_PATH}/include" CACHE PATH "Include path for ev.h" FORCE)
  6. SET(LIBEV_LIBDIR "${LIBEV_PATH}/lib" CACHE PATH "Path containing libev" FORCE)
  7. ENDIF(LIBEV_PATH)
  8. IF(LIBEV_INCLUDE_PATH)
  9. INCLUDE_DIRECTORIES(${LIBEV_INCLUDE_PATH})
  10. ENDIF(LIBEV_INCLUDE_PATH)
  11. # Use cached result
  12. IF(NOT LIBEV_FOUND)
  13. UNSET(HAVE_EV_H)
  14. UNSET(HAVE_LIBEV)
  15. UNSET(HAVE_EV_H CACHE)
  16. UNSET(HAVE_LIBEV CACHE)
  17. UNSET(LIBEV_CFLAGS)
  18. UNSET(LIBEV_LDFLAGS)
  19. IF(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
  20. SET(CMAKE_REQUIRED_INCLUDES ${LIBEV_INCLUDE_PATH})
  21. # MESSAGE(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}")
  22. CHECK_INCLUDE_FILES(ev.h HAVE_EV_H)
  23. IF(HAVE_EV_H)
  24. # MESSAGE(STATUS "Looking for lib ev in ${LIBEV_LIBDIR}")
  25. CHECK_LIBRARY_EXISTS(ev ev_time "${LIBEV_LIBDIR}" HAVE_LIBEV)
  26. IF(HAVE_LIBEV)
  27. SET(LIBEV_LIBRARIES ev CACHE INTERNAL "")
  28. SET(LIBEV_CFLAGS "" CACHE INTERNAL "")
  29. SET(LIBEV_CFLAGS_OTHER "" CACHE INTERNAL "")
  30. SET(LIBEV_INCLUDE_DIRS "" CACHE INTERNAL "")
  31. SET(LIBEV_LDFLAGS "-L${LIBEV_LIBDIR} -lev" CACHE INTERNAL "")
  32. SET(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE)
  33. ELSE(HAVE_LIBEV)
  34. MESSAGE(STATUS "Couldn't find lib ev in ${LIBEV_LIBDIR}")
  35. ENDIF(HAVE_LIBEV)
  36. ELSE(HAVE_EV_H)
  37. MESSAGE(STATUS "Couldn't find <ev.h> in ${LIBEV_INCLUDE_PATH}")
  38. ENDIF(HAVE_EV_H)
  39. ELSE(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
  40. pkg_check_modules(LIBEV libev)
  41. IF(NOT LIBEV_FOUND)
  42. # MESSAGE(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}")
  43. CHECK_INCLUDE_FILES(ev.h HAVE_EV_H)
  44. IF(HAVE_EV_H)
  45. # MESSAGE(STATUS "Looking for lib ev")
  46. CHECK_LIBRARY_EXISTS(ev ev_time "" HAVE_LIBEV)
  47. IF(HAVE_LIBEV)
  48. SET(LIBEV_CFLAGS "" CACHE INTERNAL "")
  49. SET(LIBEV_CFLAGS_OTHER "" CACHE INTERNAL "")
  50. SET(LIBEV_INCLUDE_DIRS "" CACHE INTERNAL "")
  51. SET(LIBEV_LDFLAGS "-lev" CACHE INTERNAL "")
  52. SET(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE)
  53. ELSE(HAVE_LIBEV)
  54. MESSAGE(STATUS "Couldn't find lib ev")
  55. ENDIF(HAVE_LIBEV)
  56. ELSE(HAVE_EV_H)
  57. MESSAGE(STATUS "Couldn't find <ev.h>")
  58. ENDIF(HAVE_EV_H)
  59. ENDIF(NOT LIBEV_FOUND)
  60. ENDIF(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
  61. ENDIF(NOT LIBEV_FOUND)
  62. IF(NOT LIBEV_FOUND)
  63. IF(LibEV_FIND_REQUIRED)
  64. MESSAGE(FATAL_ERROR "Could not find libev")
  65. ENDIF(LibEV_FIND_REQUIRED)
  66. ENDIF(NOT LIBEV_FOUND)
  67. MARK_AS_ADVANCED(LIBEV_PATH LIBEV_INCLUDE_PATH LIBEV_LIBDIR)