1# Copyright 2006-2008 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# - Try to find Iconv
16#
17# Once done this will define
18#
19#  ICONV_FOUND - system has Iconv
20#  ICONV_INCLUDE_DIR - the Iconv include directory
21#  ICONV_LIBRARY - Link these to use Iconv
22#  ICONV_LIBRARY_DIR - the directory in which iconv is searched
23#
24
25
26IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
27   # in cache already
28   SET(Iconv_FIND_QUIETLY TRUE)
29ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
30
31FIND_PATH(ICONV_INCLUDE_DIR iconv.h
32  HINTS ${ICONV_INCLUDE_HINT}
33  /usr/include
34  /usr/local/include
35  DOC "Include directory for the Iconv library linkage (the path to iconv.h file)"
36)
37
38FIND_LIBRARY(ICONV_LIBRARY NAMES iconv
39  HINTS ${ICONV_LIBRARY_HINT}
40  PATHS
41  /usr/${LIB_DESTINATION}
42  /usr/local/${LIB_DESTINATION}
43  DOC "Iconv library that used by Libxml2 (iconv)"
44)
45
46IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
47   SET(ICONV_FOUND TRUE)
48ELSE (ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
49   SET(ICONV_FOUND FALSE)
50ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
51
52IF(ICONV_FOUND)
53  IF(NOT Iconv_FIND_QUIETLY)
54    MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARY}")
55  ENDIF(NOT Iconv_FIND_QUIETLY)
56ELSE(ICONV_FOUND)
57  IF(Iconv_FIND_REQUIRED)
58    MESSAGE(FATAL_ERROR "Could not find Iconv")
59  ENDIF(Iconv_FIND_REQUIRED)
60ENDIF(ICONV_FOUND)
61
62MARK_AS_ADVANCED(ICONV_INCLUDE_DIR ICONV_LIBRARY)
63