1 # Try to find Libintl functionality
2 # Once done this will define
4 # LIBINTL_FOUND - system has Libintl
5 # LIBINTL_INCLUDE_DIR - Libintl include directory
6 # LIBINTL_LIBRARIES - Libraries needed to use Libintl
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).
13 # Copyright (c) 2006, Chusslove Illich, <caslav.ilic@gmx.net>
14 # Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
16 # Redistribution and use is allowed according to the terms of the BSD license.
17 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
19 if(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND)
20 set(Libintl_FIND_QUIETLY TRUE)
21 endif(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND)
23 find_path(LIBINTL_INCLUDE_DIR libintl.h)
25 find_file(LIBINTL_HEADER libintl.h
26 PATHS ${LIBINTL_INCLUDE_DIR} NO_DEFAULT_PATH)
28 set(LIBINTL_LIB_FOUND FALSE)
30 if(LIBINTL_INCLUDE_DIR)
31 include(CheckFunctionExists)
32 check_function_exists(dgettext LIBINTL_LIBC_HAS_DGETTEXT)
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 )
40 set(LIBINTL_LIB_FOUND TRUE)
41 endif(LIBINTL_LIBRARIES)
42 endif (LIBINTL_LIBC_HAS_DGETTEXT)
44 endif(LIBINTL_INCLUDE_DIR)
46 #include(FindPackageHandleStandardArgs)
47 #find_package_handle_standard_args(Libintl DEFAULT_MSG LIBINTL_INCLUDE_DIR LIBINTL_LIB_FOUND)
49 mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARIES LIBINTL_LIBC_HAS_DGETTEXT LIBINTL_LIB_FOUND)