FindHiredis.cmake 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Try to find hiredis
  2. # Once done, this will define
  3. #
  4. # HIREDIS_FOUND - system has hiredis
  5. # HIREDIS_INCLUDE_DIRS - hiredis include directories
  6. # HIREDIS_LIBRARIES - libraries need to use hiredis
  7. if (HIREDIS_INCLUDE_DIRS AND HIREDIS_LIBRARIES)
  8. set(HIREDIS_FIND_QUIETLY TRUE)
  9. else ()
  10. find_path(
  11. HIREDIS_INCLUDE_DIR
  12. NAMES hiredis/hiredis.h
  13. HINTS ${HIREDIS_ROOT_DIR}
  14. PATH_SUFFIXES include)
  15. find_library(
  16. HIREDIS_LIBRARY
  17. NAMES hiredis
  18. HINTS ${HIREDIS_ROOT_DIR}
  19. PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR})
  20. set(HIREDIS_INCLUDE_DIRS ${HIREDIS_INCLUDE_DIR})
  21. set(HIREDIS_LIBRARIES ${HIREDIS_LIBRARY})
  22. include(FindPackageHandleStandardArgs)
  23. find_package_handle_standard_args(
  24. Hiredis DEFAULT_MSG HIREDIS_LIBRARY HIREDIS_INCLUDE_DIR)
  25. mark_as_advanced(HIREDIS_LIBRARY HIREDIS_INCLUDE_DIR)
  26. endif ()
  27. if(Hiredis_FOUND)
  28. add_library(Hiredis_lib INTERFACE IMPORTED)
  29. set_target_properties(Hiredis_lib
  30. PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
  31. "${HIREDIS_INCLUDE_DIRS}"
  32. INTERFACE_LINK_LIBRARIES
  33. "${HIREDIS_LIBRARIES}")
  34. endif(Hiredis_FOUND)