2 # Once done this will define
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
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
13 #=============================================================================
14 # Copyright 2006-2009 Kitware, Inc.
15 # Copyright 2006 Alexander Neundorf <neundorf@kde.org>
17 # Distributed under the OSI-approved BSD License (the "License");
18 # see accompanying file Copyright.txt for details.
20 # This software is distributed WITHOUT ANY WARRANTY; without even the
21 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 # See the License for more information.
23 #=============================================================================
24 # (To distribute this file outside of CMake, substitute the full
25 # License text for the above reference.)
27 find_path(HSPELL_INCLUDE_DIR hspell.h)
29 find_library(HSPELL_LIBRARIES NAMES hspell)
31 if (HSPELL_INCLUDE_DIR)
32 file(STRINGS "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H REGEX "#define HSPELL_VERSION_M(AJO|INO)R [0-9]+")
33 string(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}")
34 string(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}")
35 set(HSPELL_VERSION_STRING "${HSPELL_VERSION_MAJOR}.${HSPELL_VERSION_MINOR}")
39 # handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if
40 # all listed variables are TRUE
41 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
42 FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL
43 REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR
44 VERSION_VAR HSPELL_VERSION_STRING)
46 mark_as_advanced(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)