FindHSPELL.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #.rst:
  2. # FindHSPELL
  3. # ----------
  4. #
  5. # Try to find Hspell
  6. #
  7. # Once done this will define
  8. #
  9. # ::
  10. #
  11. # HSPELL_FOUND - system has Hspell
  12. # HSPELL_INCLUDE_DIR - the Hspell include directory
  13. # HSPELL_LIBRARIES - The libraries needed to use Hspell
  14. # HSPELL_DEFINITIONS - Compiler switches required for using Hspell
  15. #
  16. #
  17. #
  18. # ::
  19. #
  20. # HSPELL_VERSION_STRING - The version of Hspell found (x.y)
  21. # HSPELL_MAJOR_VERSION - the major version of Hspell
  22. # HSPELL_MINOR_VERSION - The minor version of Hspell
  23. #=============================================================================
  24. # Copyright 2006-2009 Kitware, Inc.
  25. # Copyright 2006 Alexander Neundorf <neundorf@kde.org>
  26. #
  27. # Distributed under the OSI-approved BSD License (the "License");
  28. # see accompanying file Copyright.txt for details.
  29. #
  30. # This software is distributed WITHOUT ANY WARRANTY; without even the
  31. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  32. # See the License for more information.
  33. #=============================================================================
  34. # (To distribute this file outside of CMake, substitute the full
  35. # License text for the above reference.)
  36. find_path(HSPELL_INCLUDE_DIR hspell.h)
  37. find_library(HSPELL_LIBRARIES NAMES hspell)
  38. if (HSPELL_INCLUDE_DIR)
  39. file(STRINGS "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H REGEX "#define HSPELL_VERSION_M(AJO|INO)R [0-9]+")
  40. string(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}")
  41. string(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}")
  42. set(HSPELL_VERSION_STRING "${HSPELL_VERSION_MAJOR}.${HSPELL_VERSION_MINOR}")
  43. unset(HSPELL_H)
  44. endif()
  45. # handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if
  46. # all listed variables are TRUE
  47. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  48. FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL
  49. REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR
  50. VERSION_VAR HSPELL_VERSION_STRING)
  51. mark_as_advanced(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)