]> git.lyx.org Git - lyx.git/blob - development/cmake/modules/FindLibintl.cmake
listerrors.lyx : Update a link.
[lyx.git] / development / cmake / modules / FindLibintl.cmake
1 # Try to find Libintl functionality
2 # Once done this will define
3 #
4 #  LIBINTL_FOUND - system has Libintl
5 #  LIBINTL_INCLUDE_DIR - Libintl include directory
6 #  LIBINTL_LIBRARIES - Libraries needed to use Libintl
7 #
8 # TODO: This will enable translations only if Gettext functionality is
9 # present in libc. Must have more robust system for release, where Gettext
10 # functionality can also reside in standalone Gettext library, or the one
11 # embedded within kdelibs (cf. gettext.m4 from Gettext source).
12
13 # Copyright (c) 2006, Chusslove Illich, <caslav.ilic@gmx.net>
14 # Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
15 #
16 # Redistribution and use is allowed according to the terms of the BSD license.
17 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
18
19 if(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND)
20   set(Libintl_FIND_QUIETLY TRUE)
21 endif(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND)
22
23 find_path(LIBINTL_INCLUDE_DIR libintl.h)
24
25 find_file(LIBINTL_HEADER libintl.h
26         PATHS ${LIBINTL_INCLUDE_DIR} NO_DEFAULT_PATH)
27         
28 set(LIBINTL_LIB_FOUND FALSE)
29
30 if(LIBINTL_INCLUDE_DIR)
31   include(CheckFunctionExists)
32   check_function_exists(dgettext LIBINTL_LIBC_HAS_DGETTEXT)
33
34   if (LIBINTL_LIBC_HAS_DGETTEXT)
35     set(LIBINTL_LIBRARIES)
36     set(LIBINTL_LIB_FOUND TRUE)
37   else (LIBINTL_LIBC_HAS_DGETTEXT)
38     find_library(LIBINTL_LIBRARIES NAMES intl libintl )
39     if(LIBINTL_LIBRARIES)
40       set(LIBINTL_LIB_FOUND TRUE)
41     endif(LIBINTL_LIBRARIES)
42   endif (LIBINTL_LIBC_HAS_DGETTEXT)
43
44 endif(LIBINTL_INCLUDE_DIR)
45
46 #include(FindPackageHandleStandardArgs)
47 #find_package_handle_standard_args(Libintl  DEFAULT_MSG  LIBINTL_INCLUDE_DIR  LIBINTL_LIB_FOUND)
48
49 mark_as_advanced(LIBINTL_INCLUDE_DIR  LIBINTL_LIBRARIES  LIBINTL_LIBC_HAS_DGETTEXT  LIBINTL_LIB_FOUND)