FindHSPELL.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindHSPELL
  5. ----------
  6. Try to find Hebrew spell-checker (Hspell) and morphology engine.
  7. Once done this will define
  8. ::
  9. HSPELL_FOUND - system has Hspell
  10. HSPELL_INCLUDE_DIR - the Hspell include directory
  11. HSPELL_LIBRARIES - The libraries needed to use Hspell
  12. HSPELL_DEFINITIONS - Compiler switches required for using Hspell
  13. ::
  14. HSPELL_VERSION_STRING - The version of Hspell found (x.y)
  15. HSPELL_MAJOR_VERSION - the major version of Hspell
  16. HSPELL_MINOR_VERSION - The minor version of Hspell
  17. #]=======================================================================]
  18. find_path(HSPELL_INCLUDE_DIR hspell.h)
  19. find_library(HSPELL_LIBRARIES NAMES hspell)
  20. if (HSPELL_INCLUDE_DIR)
  21. file(STRINGS "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H REGEX "#define HSPELL_VERSION_M(AJO|INO)R [0-9]+")
  22. string(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}")
  23. string(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}")
  24. set(HSPELL_VERSION_STRING "${HSPELL_VERSION_MAJOR}.${HSPELL_VERSION_MINOR}")
  25. unset(HSPELL_H)
  26. endif()
  27. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  28. FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL
  29. REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR
  30. VERSION_VAR HSPELL_VERSION_STRING)
  31. mark_as_advanced(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)