Commit | Line | Data |
---|---|---|
438d977e JS |
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 | set(LIBINTL_LIB_FOUND FALSE) | |
26 | ||
27 | if(LIBINTL_INCLUDE_DIR) | |
28 | include(CheckFunctionExists) | |
29 | check_function_exists(dgettext LIBINTL_LIBC_HAS_DGETTEXT) | |
30 | ||
31 | if (LIBINTL_LIBC_HAS_DGETTEXT) | |
32 | set(LIBINTL_LIBRARIES) | |
33 | set(LIBINTL_LIB_FOUND TRUE) | |
34 | else (LIBINTL_LIBC_HAS_DGETTEXT) | |
35 | find_library(LIBINTL_LIBRARIES NAMES intl libintl ) | |
36 | if(LIBINTL_LIBRARIES) | |
37 | set(LIBINTL_LIB_FOUND TRUE) | |
38 | endif(LIBINTL_LIBRARIES) | |
39 | endif (LIBINTL_LIBC_HAS_DGETTEXT) | |
40 | ||
41 | endif(LIBINTL_INCLUDE_DIR) | |
42 | ||
43 | include(FindPackageHandleStandardArgs) | |
44 | find_package_handle_standard_args(Libintl DEFAULT_MSG LIBINTL_INCLUDE_DIR LIBINTL_LIB_FOUND) | |
45 | ||
46 | mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARIES LIBINTL_LIBC_HAS_DGETTEXT LIBINTL_LIB_FOUND) | |
47 |