FindReadline.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Code copied from sethhall@github
  2. #
  3. # - Try to find readline include dirs and libraries
  4. #
  5. # Usage of this module as follows:
  6. #
  7. # find_package(Readline)
  8. #
  9. # Variables used by this module, they can change the default behaviour and need
  10. # to be set before calling find_package:
  11. #
  12. # Readline_ROOT_DIR Set this variable to the root installation of
  13. # readline if the module has problems finding the
  14. # proper installation path.
  15. #
  16. # Variables defined by this module:
  17. #
  18. # READLINE_FOUND System has readline, include and lib dirs found
  19. # Readline_INCLUDE_DIR The readline include directories.
  20. # Readline_LIBRARY The readline library.
  21. find_path(Readline_ROOT_DIR
  22. NAMES include/readline/readline.h
  23. )
  24. find_path(Readline_INCLUDE_DIR
  25. NAMES readline/readline.h
  26. HINTS ${Readline_ROOT_DIR}/include
  27. )
  28. find_library(Readline_LIBRARY
  29. NAMES readline
  30. HINTS ${Readline_ROOT_DIR}/lib
  31. )
  32. if(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
  33. set(READLINE_FOUND TRUE)
  34. else(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
  35. FIND_LIBRARY(Readline_LIBRARY NAMES readline)
  36. include(FindPackageHandleStandardArgs)
  37. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY )
  38. MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY)
  39. endif(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
  40. mark_as_advanced(
  41. Readline_ROOT_DIR
  42. Readline_INCLUDE_DIR
  43. Readline_LIBRARY
  44. )