diff options
Diffstat (limited to 'modules/FindGettext.cmake')
-rw-r--r-- | modules/FindGettext.cmake | 87 |
1 files changed, 51 insertions, 36 deletions
diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index a117ebf7..3a3b6902 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -10,43 +10,58 @@ # functionality can also reside in standalone Gettext library, or the one # embedded within kdelibs (cf. gettext.m4 from Gettext source). -include(CheckIncludeFiles) -include(CheckLibraryExists) -include(CheckFunctionExists) +IF (CACHED_GETTEXT) -check_include_files(libintl.h HAVE_LIBINTL_H) + # in cache already + IF ("${CACHED_GETTEXT}" STREQUAL "YES") + SET(GETTEXT_FOUND TRUE) + ENDIF ("${CACHED_GETTEXT}" STREQUAL "YES") -set(GETTEXT_INCLUDE_DIR) -set(GETTEXT_LIBRARIES) +ELSE (CACHED_GETTEXT) -if (HAVE_LIBINTL_H) - check_function_exists(dgettext LIBC_HAS_DGETTEXT) - if (LIBC_HAS_DGETTEXT) - set(GETTEXT_SOURCE "built in libc") - set(GETTEXT_FOUND TRUE) - else (LIBC_HAS_DGETTEXT) - FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl - PATHS - /usr/lib - /usr/local/lib - ) - CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) - if (LIBINTL_HAS_DGETTEXT) - set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") - set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) - set(GETTEXT_FOUND TRUE) - endif (LIBINTL_HAS_DGETTEXT) - endif (LIBC_HAS_DGETTEXT) -endif (HAVE_LIBINTL_H) + include(CheckIncludeFiles) + include(CheckLibraryExists) + include(CheckFunctionExists) + + check_include_files(libintl.h HAVE_LIBINTL_H) + + set(GETTEXT_INCLUDE_DIR) + set(GETTEXT_LIBRARIES) + + if (HAVE_LIBINTL_H) + check_function_exists(dgettext LIBC_HAS_DGETTEXT) + if (LIBC_HAS_DGETTEXT) + set(GETTEXT_SOURCE "built in libc") + set(GETTEXT_FOUND TRUE) + else (LIBC_HAS_DGETTEXT) + FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl + PATHS + /usr/lib + /usr/local/lib + ) + CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) + if (LIBINTL_HAS_DGETTEXT) + set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") + set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY} CACHE FILEPATH "path to libintl library, used for gettext") + set(GETTEXT_FOUND TRUE) + endif (LIBINTL_HAS_DGETTEXT) + endif (LIBC_HAS_DGETTEXT) + endif (HAVE_LIBINTL_H) + + if (GETTEXT_FOUND) + set(CACHED_GETTEXT "YES") + if (NOT Gettext_FIND_QUIETLY) + message(STATUS "Found Gettext: ${GETTEXT_SOURCE}") + endif (NOT Gettext_FIND_QUIETLY) + else (GETTEXT_FOUND) + if (Gettext_FIND_REQUIRED) + message(STATUS "Could NOT find Gettext") + else (Gettext_FIND_REQUIRED) + set(CACHED_GETTEXT "NO") + endif (Gettext_FIND_REQUIRED) + endif (GETTEXT_FOUND) + + set(CACHED_GETTEXT ${CACHED_GETTEXT} CACHE INTERNAL "If gettext was checked") + MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) -if (GETTEXT_FOUND) - if (NOT Gettext_FIND_QUIETLY) - message(STATUS "Found Gettext: ${GETTEXT_SOURCE}") - endif (NOT Gettext_FIND_QUIETLY) -else (GETTEXT_FOUND) - if (Gettext_FIND_REQUIRED) - message(STATUS "Could NOT find Gettext") - endif (Gettext_FIND_REQUIRED) -endif (GETTEXT_FOUND) - -MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) +ENDIF( CACHED_GETTEXT ) |