aboutsummaryrefslogtreecommitdiff
path: root/modules/FindENCHANT.cmake
blob: 1a12fe6b622538bd96d423d5b7282e37365b2163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# - Try to find the Enchant spell checker
# Once done this will define
#
#  ENCHANT_FOUND - system has ENCHANT
#  ENCHANT_INCLUDE_DIR - the ENCHANT include directory
#  ENCHANT_LIBRARIES - Link these to use ENCHANT
#  ENCHANT_DEFINITIONS - Compiler switches required for using ENCHANT
#
# Copyright (c) 2006, Zack Rusin, <zack@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.


if (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES)

  # in cache already
  SET(ENCHANT_FOUND TRUE)

else (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES)
IF (NOT WIN32)
  # use pkg-config to get the directories and then use these values
  # in the FIND_PATH() and FIND_LIBRARY() calls
  INCLUDE(UsePkgConfig)
  
  PKGCONFIG(enchant _ENCHANTIncDir _ENCHANTLinkDir _ENCHANTLinkFlags _ENCHANTCflags)
  
  set(ENCHANT_DEFINITIONS ${_ENCHANTCflags})
ENDIF (NOT WIN32)  
  FIND_PATH(ENCHANT_INCLUDE_DIR enchant++.h
    ${_ENCHANTIncDir}
    /usr/include
    /usr/include/enchant
    /usr/local/include
    /usr/local/include/enchant
  )
  
  FIND_LIBRARY(ENCHANT_LIBRARIES NAMES enchant
    PATHS
    ${_ENCHANTLinkDir}
    /usr/lib
    /usr/local/lib
  )
  
  if (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES)
     set(ENCHANT_FOUND TRUE)
  endif (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES)
  
  if (ENCHANT_FOUND)
    if (NOT ENCHANT_FIND_QUIETLY)
      message(STATUS "Found ENCHANT: ${ENCHANT_LIBRARIES}")
    endif (NOT ENCHANT_FIND_QUIETLY)
  else (ENCHANT_FOUND)
    if (ENCHANT_FIND_REQUIRED)
      message(FATAL_ERROR "Could NOT find ENCHANT")
    endif (ENCHANT_FIND_REQUIRED)
  endif (ENCHANT_FOUND)
  
  MARK_AS_ADVANCED(ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES)
  
endif (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES)