FindHSPELL.cmake 2.0 KB

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