From 1da5e248e7cb198bf97c55f5b66b3158c94adeeb Mon Sep 17 00:00:00 2001 From: Chusslove Illich Date: Sat, 18 Mar 2006 15:18:02 +0000 Subject: CMake configure check for Gettext, rudimentary only. svn path=/trunk/KDE/kdelibs/; revision=520012 --- modules/FindGettext.cmake | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 modules/FindGettext.cmake (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake new file mode 100644 index 00000000..b6dd3de5 --- /dev/null +++ b/modules/FindGettext.cmake @@ -0,0 +1,35 @@ +# Try to find Gettext functionality +# Once done this will define +# +# GETTEXT_FOUND - system has Gettext +# GETTEXT_INCLUDE_DIR - Gettext include directory +# GETTEXT_LIBRARIES - Libraries needed to use Gettext + +# TODO: This will enable translations only if Gettext functionality is +# present in libc. Must have more robust system for release, where Gettext +# functionality can also reside in standalone Gettext library, or the one +# embedded within kdelibs (cf. gettext.m4 from Gettext source). + +INCLUDE(CheckIncludeFiles) +check_include_files(libintl.h HAVE_LIBINTL_H) + +set(GETTEXT_INCLUDE_DIR) +set(GETTEXT_LIBRARIES) + +if(HAVE_LIBINTL_H) + set(GETTEXT_FOUND TRUE) + set(GETTEXT_SOURCE "libintl.h") +endif(HAVE_LIBINTL_H) + +if(GETTEXT_FOUND) + if(NOT Gettext_FIND_QUIETLY) + message(STATUS "Gettext functionality present (${GETTEXT_SOURCE})") + endif(NOT Gettext_FIND_QUIETLY) +else(GETTEXT_FOUND) + if(NOT Gettext_FIND_QUIETLY) + message(STATUS "Gettext functionality NOT present, " + "translations will not be available") + endif(NOT Gettext_FIND_QUIETLY) +endif(GETTEXT_FOUND) + +MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) -- cgit v1.2.1 From 191846e3e21c697c28bd5c8a166edeb4072161e3 Mon Sep 17 00:00:00 2001 From: Allen Winter Date: Mon, 20 Mar 2006 21:05:37 +0000 Subject: minor cleanups: indenting, adding newline to end of file, etc. svn path=/trunk/KDE/kdelibs/; revision=520790 --- modules/FindGettext.cmake | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index b6dd3de5..2244b742 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -16,20 +16,20 @@ check_include_files(libintl.h HAVE_LIBINTL_H) set(GETTEXT_INCLUDE_DIR) set(GETTEXT_LIBRARIES) -if(HAVE_LIBINTL_H) +if (HAVE_LIBINTL_H) set(GETTEXT_FOUND TRUE) set(GETTEXT_SOURCE "libintl.h") -endif(HAVE_LIBINTL_H) +endif (HAVE_LIBINTL_H) -if(GETTEXT_FOUND) - if(NOT Gettext_FIND_QUIETLY) +if (GETTEXT_FOUND) + if (NOT Gettext_FIND_QUIETLY) message(STATUS "Gettext functionality present (${GETTEXT_SOURCE})") - endif(NOT Gettext_FIND_QUIETLY) -else(GETTEXT_FOUND) - if(NOT Gettext_FIND_QUIETLY) + endif (NOT Gettext_FIND_QUIETLY) +else (GETTEXT_FOUND) + if (NOT Gettext_FIND_QUIETLY) message(STATUS "Gettext functionality NOT present, " "translations will not be available") - endif(NOT Gettext_FIND_QUIETLY) -endif(GETTEXT_FOUND) + endif (NOT Gettext_FIND_QUIETLY) +endif (GETTEXT_FOUND) MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) -- cgit v1.2.1 From fbab97f4ca86b780d8351e063672dda8cf84bd04 Mon Sep 17 00:00:00 2001 From: Chusslove Illich Date: Tue, 21 Mar 2006 21:47:55 +0000 Subject: Messages for Gettext configure check more in line with others. svn path=/trunk/KDE/kdelibs/; revision=521204 --- modules/FindGettext.cmake | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 2244b742..cc29f0c1 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -18,18 +18,17 @@ set(GETTEXT_LIBRARIES) if (HAVE_LIBINTL_H) set(GETTEXT_FOUND TRUE) - set(GETTEXT_SOURCE "libintl.h") + set(GETTEXT_SOURCE "built in libc (libintl.h present)") endif (HAVE_LIBINTL_H) if (GETTEXT_FOUND) if (NOT Gettext_FIND_QUIETLY) - message(STATUS "Gettext functionality present (${GETTEXT_SOURCE})") + message(STATUS "Found Gettext: ${GETTEXT_SOURCE}") endif (NOT Gettext_FIND_QUIETLY) else (GETTEXT_FOUND) - if (NOT Gettext_FIND_QUIETLY) - message(STATUS "Gettext functionality NOT present, " - "translations will not be available") - endif (NOT Gettext_FIND_QUIETLY) + 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) -- cgit v1.2.1 From 52859673a5572bf58945fc024b93f3f8edfc052c Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 21 Mar 2006 23:49:38 +0000 Subject: GETTEXT_LIBRARIES was used, but never actually set to anything. This is necessary for me on the Mac (not sure why it linked on linux...) svn path=/trunk/KDE/kdelibs/; revision=521236 --- modules/FindGettext.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index cc29f0c1..be931d80 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -21,6 +21,14 @@ if (HAVE_LIBINTL_H) set(GETTEXT_SOURCE "built in libc (libintl.h present)") endif (HAVE_LIBINTL_H) +# Check for libintl, and check that it provides libintl_dgettext. +FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl + PATHS + /usr/lib + /usr/local/lib +) +CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "libintl_dgettext" "" GETTEXT_LIBRARIES) + if (GETTEXT_FOUND) if (NOT Gettext_FIND_QUIETLY) message(STATUS "Found Gettext: ${GETTEXT_SOURCE}") -- cgit v1.2.1 From 96a39d352efa62c1ab64cf412b1893288b970b97 Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 22 Mar 2006 00:10:50 +0000 Subject: Works better this way (still for Mac OS X). OK, on Linux it comes from glibc. So instead of always looking for a libintl, maybe we should first check do a "check if this call links without linking to anything else than the libc"... svn path=/trunk/KDE/kdelibs/; revision=521239 --- modules/FindGettext.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index be931d80..8b3b078d 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -21,13 +21,17 @@ if (HAVE_LIBINTL_H) set(GETTEXT_SOURCE "built in libc (libintl.h present)") endif (HAVE_LIBINTL_H) -# Check for libintl, and check that it provides libintl_dgettext. +# Check for libintl, and check that it provides libintl_dgettext. Needed on BSD systems (e.g. Mac OS X) FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl PATHS /usr/lib /usr/local/lib ) -CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "libintl_dgettext" "" GETTEXT_LIBRARIES) +CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT) +if (LIBINTL_HAS_DGETTEXT) + set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") + set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) +endif (LIBINTL_HAS_DGETTEXT) if (GETTEXT_FOUND) if (NOT Gettext_FIND_QUIETLY) -- cgit v1.2.1 From d51dbe7b9a0864fa536a80bb898d4bfecd308221 Mon Sep 17 00:00:00 2001 From: Chusslove Illich Date: Wed, 22 Mar 2006 11:02:32 +0000 Subject: Gettext check updated. svn path=/trunk/KDE/kdelibs/; revision=521323 --- modules/FindGettext.cmake | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 8b3b078d..3eae44a0 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -18,7 +18,7 @@ set(GETTEXT_LIBRARIES) if (HAVE_LIBINTL_H) set(GETTEXT_FOUND TRUE) - set(GETTEXT_SOURCE "built in libc (libintl.h present)") + set(GETTEXT_SOURCE "built in libc") endif (HAVE_LIBINTL_H) # Check for libintl, and check that it provides libintl_dgettext. Needed on BSD systems (e.g. Mac OS X) @@ -27,11 +27,14 @@ FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl /usr/lib /usr/local/lib ) -CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT) -if (LIBINTL_HAS_DGETTEXT) - set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") - set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) -endif (LIBINTL_HAS_DGETTEXT) + +if (LIBINTL_LIBRARY) + CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT) + if (LIBINTL_HAS_DGETTEXT) + set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") + set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) + endif (LIBINTL_HAS_DGETTEXT) +endif (LIBINTL_LIBRARY) if (GETTEXT_FOUND) if (NOT Gettext_FIND_QUIETLY) -- cgit v1.2.1 From c80ebd38d8cb1d02dbd5a94fcca60c8bffd51404 Mon Sep 17 00:00:00 2001 From: Hasso Tepper Date: Mon, 27 Mar 2006 16:05:59 +0000 Subject: Better gettext find test. Tested with Linux and NetBSD. svn path=/trunk/KDE/kdelibs/; revision=523195 --- modules/FindGettext.cmake | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 3eae44a0..26bab048 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -11,31 +11,33 @@ # embedded within kdelibs (cf. gettext.m4 from Gettext source). INCLUDE(CheckIncludeFiles) +include(CheckFunctionExists) + check_include_files(libintl.h HAVE_LIBINTL_H) set(GETTEXT_INCLUDE_DIR) set(GETTEXT_LIBRARIES) if (HAVE_LIBINTL_H) - set(GETTEXT_FOUND TRUE) - set(GETTEXT_SOURCE "built in libc") + 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) -# Check for libintl, and check that it provides libintl_dgettext. Needed on BSD systems (e.g. Mac OS X) -FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl - PATHS - /usr/lib - /usr/local/lib -) - -if (LIBINTL_LIBRARY) - CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT) - if (LIBINTL_HAS_DGETTEXT) - set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") - set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) - endif (LIBINTL_HAS_DGETTEXT) -endif (LIBINTL_LIBRARY) - if (GETTEXT_FOUND) if (NOT Gettext_FIND_QUIETLY) message(STATUS "Found Gettext: ${GETTEXT_SOURCE}") -- cgit v1.2.1 From 37e97e7ae605fdff2aa7b1beda154ba0ae015555 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 10 Apr 2006 08:54:08 +0000 Subject: Reported to fix compilation with msvc. svn path=/trunk/KDE/kdelibs/; revision=528134 --- modules/FindGettext.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 26bab048..a117ebf7 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -10,7 +10,8 @@ # functionality can also reside in standalone Gettext library, or the one # embedded within kdelibs (cf. gettext.m4 from Gettext source). -INCLUDE(CheckIncludeFiles) +include(CheckIncludeFiles) +include(CheckLibraryExists) include(CheckFunctionExists) check_include_files(libintl.h HAVE_LIBINTL_H) -- cgit v1.2.1 From 968fec0a7b604bb1c463aae6ff7bb9726407af72 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 14 Apr 2006 11:49:02 +0000 Subject: Actually use the cache whenever possible. Should speed up the re-configuring that happens so often. svn path=/trunk/KDE/kdelibs/; revision=529759 --- modules/FindGettext.cmake | 87 +++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 36 deletions(-) (limited to 'modules/FindGettext.cmake') 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 ) -- cgit v1.2.1 From 2b43aad081d13bdeb2ed8a65f65fbecfb470da0d Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 18 Apr 2006 11:22:38 +0000 Subject: More use of the cache; fixing previous commit to not recheck everytime when something isn't available (e.g. agg for me). svn path=/trunk/KDE/kdelibs/; revision=531000 --- modules/FindGettext.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 3a3b6902..fccd332f 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -10,14 +10,14 @@ # functionality can also reside in standalone Gettext library, or the one # embedded within kdelibs (cf. gettext.m4 from Gettext source). -IF (CACHED_GETTEXT) +IF (DEFINED CACHED_GETTEXT) # in cache already IF ("${CACHED_GETTEXT}" STREQUAL "YES") SET(GETTEXT_FOUND TRUE) ENDIF ("${CACHED_GETTEXT}" STREQUAL "YES") -ELSE (CACHED_GETTEXT) +ELSE (DEFINED CACHED_GETTEXT) include(CheckIncludeFiles) include(CheckLibraryExists) @@ -64,4 +64,4 @@ ELSE (CACHED_GETTEXT) set(CACHED_GETTEXT ${CACHED_GETTEXT} CACHE INTERNAL "If gettext was checked") MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) -ENDIF( CACHED_GETTEXT ) +ENDIF(DEFINED CACHED_GETTEXT) -- cgit v1.2.1 From a1cd53cff402332c1bcf7a625b33d9330a247608 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 11 May 2006 16:56:59 +0000 Subject: Remove my CACHED_ hacks which break when people install libxml2 after seeing the error message about it - only use the cache when the check was previously successful, as discussed. svn path=/trunk/KDE/kdelibs/; revision=539759 --- modules/FindGettext.cmake | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index fccd332f..e4dda701 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -10,14 +10,12 @@ # functionality can also reside in standalone Gettext library, or the one # embedded within kdelibs (cf. gettext.m4 from Gettext source). -IF (DEFINED CACHED_GETTEXT) +if (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) # in cache already - IF ("${CACHED_GETTEXT}" STREQUAL "YES") - SET(GETTEXT_FOUND TRUE) - ENDIF ("${CACHED_GETTEXT}" STREQUAL "YES") + SET(GETTEXT_FOUND TRUE) -ELSE (DEFINED CACHED_GETTEXT) +else (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) include(CheckIncludeFiles) include(CheckLibraryExists) @@ -49,19 +47,15 @@ ELSE (DEFINED CACHED_GETTEXT) 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) -ENDIF(DEFINED CACHED_GETTEXT) +endif (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) -- cgit v1.2.1 From c778596920e0d5357f216c885e35b4f97d371a23 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Sat, 9 Sep 2006 10:18:35 +0000 Subject: added copyright notice everywhere. Now they all are BSD-licensed, as copyright holder I inserted everywhere the one who added it to svn (or Kitware if it is an enhanced copy from taken cmake) Some developers committed quite often but were not the ones who added the file, if you feel you have also copyright on the file add your name in the specific file. Copyright holders: CCMAIL: montel@kde.org CCMAIL: toscano.pino@tiscali.it CCMAIL: adymo@kdevelop.org CCMAIL: ranger@befunk.com CCMAIL: zack@kde.org CCMAIL: caslav.ilic@gmx.net CCMAIL: syntheticpp@yahoo.com CCMAIL: js@iidea.pl CCMAIL: michael.larouche@kdemail.net CCMAIL: ossi@kde.org CCMAIL: faure@kde.org Committers, but no files added so that they are not listed as copyright holders: CCMAIL: ch.ehrlicher@gmx.de CCMAIL: winter@kde.org CCMAIL: ralf.habacker@freenet.de CCMAIL: moura@kdewebdev.org CCMAIL: kde-buildsystem@kde.org Alex svn path=/trunk/KDE/kdelibs/; revision=582410 --- modules/FindGettext.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index e4dda701..c6b096c8 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -9,6 +9,12 @@ # present in libc. Must have more robust system for release, where Gettext # functionality can also reside in standalone Gettext library, or the one # embedded within kdelibs (cf. gettext.m4 from Gettext source). +# +# Copyright (c) 2006, Chusslove Illich, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + if (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) -- cgit v1.2.1 From a7c4888bb864b525568df10219915c3925d3dd61 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Mon, 6 Aug 2007 18:53:48 +0000 Subject: Remove not necessary path svn path=/trunk/KDE/kdelibs/; revision=697081 --- modules/FindGettext.cmake | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index c6b096c8..24c2f98a 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -38,11 +38,8 @@ else (LIBC_HAS_DGETTEXT OR LIBINTL_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 - ) + FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl ) + CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) if (LIBINTL_HAS_DGETTEXT) set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") -- cgit v1.2.1 From 6b0cda9db133c1e449d59dd4519ba18425c564bd Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Wed, 8 Aug 2007 11:28:42 +0000 Subject: Make it "fatal" svn path=/trunk/KDE/kdelibs/; revision=697668 --- modules/FindGettext.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 24c2f98a..3b7422ff 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -55,7 +55,7 @@ else (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) endif (NOT Gettext_FIND_QUIETLY) else (GETTEXT_FOUND) if (Gettext_FIND_REQUIRED) - message(STATUS "Could NOT find Gettext") + message(FATAL_ERROR "Could NOT find Gettext") endif (Gettext_FIND_REQUIRED) endif (GETTEXT_FOUND) -- cgit v1.2.1 From 5298c8ba82af22d4f7fd093388a4add4ef332a4f Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Sat, 11 Aug 2007 02:01:10 +0000 Subject: add stuff from cmake cvs and macros for processing po and pot files Alex svn path=/trunk/KDE/kdelibs/; revision=698778 --- modules/FindGettext.cmake | 171 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 3b7422ff..b461fe51 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -62,3 +62,174 @@ else (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) endif (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) + + +# - Find GNU gettext tools +# This module looks for the GNU gettext tools. This module defines the +# following values: +# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool. +# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool. +# GETTEXT_FOUND: True if gettext has been found. +# +# Additionally it provides the following macros: +# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN ) +# This will create a target "translations" which will convert the +# given input po files into the binary output mo file. If the +# ALL option is used, the translations will also be created when +# building the default target. +# GETTEXT_PROCESS_POT( [ALL] [INSTALL_DESTINATION ] ... ) +# Process the given pot file to mo files. +# If INSTALL_DESTINATION is given then automatically install rules will be created, +# the language subdirectory will be taken into account (by default use share/locale/). +# If ALL is specified, the pot file is processed when building the all traget. +# It creates a custom target "potfile". +# +# GETTEXT_PROCESS_PO_FILES( [ALL] [INSTALL_DESTINATION ] ...) +# Process the given po files to mo files for the given language. +# If INSTALL_DESTINATION is given then automatically install rules will be created, +# the language subdirectory will be taken into account (by default use share/locale/). +# If ALL is specified, the po files are processed when building the all traget. +# It creates a custom target "pofiles". + + + +FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) + +FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt) + +MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFile) + + SET(_gmoFiles) + GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE) + GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) + + SET(_addToAll) + IF(${_firstPoFile} STREQUAL "ALL") + SET(_addToAll "ALL") + SET(_firstPoFile) + ENDIF(${_firstPoFile} STREQUAL "ALL") + + FOREACH (_currentPoFile ${ARGN}) + GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE) + GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH) + GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE) + SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) + + ADD_CUSTOM_COMMAND( + OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} + DEPENDS ${_absPotFile} ${_absFile} + ) + + INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) + + ENDFOREACH (_currentPoFile ) + + ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles}) + +ENDMACRO(GETTEXT_CREATE_TRANSLATIONS ) + +# GETTEXT_PROCESS_POT( [ALL] [INSTALL_DESTINATION ] ... ) +MACRO(GETTEXT_PROCESS_POT_FILE _potFile) + + SET(_gmoFiles) + SET(_args ${ARGN}) + SET(_addToAll) + SET(_installDest) + + LIST(GET _args 0 _tmp) + IF("${_tmp}" STREQUAL "ALL") + SET(_addToAll ALL) + LIST(REMOVE_AT _args 0) + ENDIF("${_tmp}" STREQUAL "ALL") + + LIST(GET _args 0 _tmp) + IF("${_tmp}" STREQUAL "INSTALL_DESTINATION") + LIST(GET _args 1 _installDest ) + LIST(REMOVE_AT _args 0 1) + ENDIF("${_tmp}" STREQUAL "INSTALL_DESTINATION") + + GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE) + GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) + +# message(STATUS "1 all ${_addToAll} dest ${_installDest} args: ${_args}") + + FOREACH (_lang ${_args}) + SET(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po") + SET(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo") + + ADD_CUSTOM_COMMAND( + OUTPUT "${_poFile}" + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile} + DEPENDS ${_absPotFile} + ) + + ADD_CUSTOM_COMMAND( + OUTPUT "${_gmoFile}" + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile} + DEPENDS ${_absPotFile} ${_poFile} + ) + + IF(_installDest) + INSTALL(FILES ${_gmoFile} DESTINATION ${_installDest}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + ENDIF(_installDest) + LIST(APPEND _gmoFiles ${_gmoFile}) + + ENDFOREACH (_lang ) + + ADD_CUSTOM_TARGET(potfile ${_addToAll} DEPENDS ${_gmoFiles}) + +ENDMACRO(GETTEXT_PROCESS_POT_FILE) + + +# GETTEXT_PROCESS_PO_FILES( [ALL] [INSTALL_DESTINATION ] ...) +MACRO(GETTEXT_PROCESS_PO_FILES _lang) + SET(_gmoFiles) + SET(_args ${ARGN}) + SET(_addToAll) + SET(_installDest) + + LIST(GET _args 0 _tmp) + IF("${_tmp}" STREQUAL "ALL") + SET(_addToAll ALL) + LIST(REMOVE_AT _args 0) + ENDIF("${_tmp}" STREQUAL "ALL") + + LIST(GET _args 0 _tmp) + IF("${_tmp}" STREQUAL "INSTALL_DESTINATION") + LIST(GET _args 1 _installDest ) + LIST(REMOVE_AT _args 0 1) + ENDIF("${_tmp}" STREQUAL "INSTALL_DESTINATION") + +# message(STATUS "2 all ${_addToAll} dest ${_installDest} args: ${_args}") + + FOREACH(_current_PO_FILE ${_args}) + GET_FILENAME_COMPONENT(_basename ${_current_PO_FILE} NAME_WE) + SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) + add_custom_command(OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} + DEPENDS ${_current_PO_FILE} + ) + + IF(_installDest) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_installDest}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo) + ENDIF(_installDest) + LIST(APPEND _gmoFiles ${_gmoFile}) + ENDFOREACH(_current_PO_FILE) + ADD_CUSTOM_TARGET(pofiles ${_addToAll} DEPENDS ${_gmoFiles}) +ENDMACRO(GETTEXT_PROCESS_PO_FILES) + + +#IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) +# SET(GETTEXT_FOUND TRUE) +#ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) +# SET(GETTEXT_FOUND FALSE) +# IF (GetText_REQUIRED) +# MESSAGE(FATAL_ERROR "GetText not found") +# ENDIF (GetText_REQUIRED) +#ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) + + + -- cgit v1.2.1 From 2f2f14289d4a63d53140fdbd336890f51d332a78 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Thu, 16 Aug 2007 02:18:48 +0000 Subject: also work if used with too few arguments Alex svn path=/trunk/KDE/kdelibs/; revision=700613 --- modules/FindGettext.cmake | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index b461fe51..121c59a5 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -139,17 +139,21 @@ MACRO(GETTEXT_PROCESS_POT_FILE _potFile) SET(_addToAll) SET(_installDest) - LIST(GET _args 0 _tmp) - IF("${_tmp}" STREQUAL "ALL") - SET(_addToAll ALL) - LIST(REMOVE_AT _args 0) - ENDIF("${_tmp}" STREQUAL "ALL") - - LIST(GET _args 0 _tmp) - IF("${_tmp}" STREQUAL "INSTALL_DESTINATION") - LIST(GET _args 1 _installDest ) - LIST(REMOVE_AT _args 0 1) - ENDIF("${_tmp}" STREQUAL "INSTALL_DESTINATION") + IF(_args) + LIST(GET _args 0 _tmp) + IF("${_tmp}" STREQUAL "ALL") + SET(_addToAll ALL) + LIST(REMOVE_AT _args 0) + ENDIF("${_tmp}" STREQUAL "ALL") + ENDIF(_args) + + IF(_args) + LIST(GET _args 0 _tmp) + IF("${_tmp}" STREQUAL "INSTALL_DESTINATION") + LIST(GET _args 1 _installDest ) + LIST(REMOVE_AT _args 0 1) + ENDIF("${_tmp}" STREQUAL "INSTALL_DESTINATION") + ENDIF(_args) GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE) GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) -- cgit v1.2.1 From 71749c79337d8470aeaf8809378eba45ae3c2ee4 Mon Sep 17 00:00:00 2001 From: Tom Albers Date: Tue, 20 Nov 2007 21:00:19 +0000 Subject: The po file is located in the source dir, so cd to that folder instead of the build dir. See k-c-d. svn path=/trunk/KDE/kdelibs/; revision=739317 --- modules/FindGettext.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 121c59a5..682906e5 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -214,6 +214,7 @@ MACRO(GETTEXT_PROCESS_PO_FILES _lang) SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) add_custom_command(OUTPUT ${_gmoFile} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" DEPENDS ${_current_PO_FILE} ) -- cgit v1.2.1 From 9215cdab458b5fdc16343157dacd78ef82245ae1 Mon Sep 17 00:00:00 2001 From: Allen Winter Date: Wed, 16 Apr 2008 20:37:25 +0000 Subject: don't put set variables into the CACHE, per Brad King svn path=/trunk/KDE/kdelibs/; revision=797757 --- modules/FindGettext.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 682906e5..8c50e43f 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -43,7 +43,7 @@ else (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) 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_LIBRARIES ${LIBINTL_LIBRARY}) set(GETTEXT_FOUND TRUE) endif (LIBINTL_HAS_DGETTEXT) endif (LIBC_HAS_DGETTEXT) -- cgit v1.2.1 From 26c3c040c23e00ad5cdf4053429870365d0097f2 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Fri, 2 Jan 2009 16:20:12 +0000 Subject: -replace check_include_files() with find_path(), should fix the problem on OSX where libintl.h is in /opt/somewhere.../ and was not found by check_include_files() Alex svn path=/trunk/KDE/kdelibs/; revision=904608 --- modules/FindGettext.cmake | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'modules/FindGettext.cmake') diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 8c50e43f..e35dceda 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -19,28 +19,31 @@ if (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) # in cache already - SET(GETTEXT_FOUND TRUE) + set(GETTEXT_FOUND TRUE) else (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) - include(CheckIncludeFiles) include(CheckLibraryExists) include(CheckFunctionExists) - - check_include_files(libintl.h HAVE_LIBINTL_H) - - set(GETTEXT_INCLUDE_DIR) + + find_path(GETTEXT_INCLUDE_DIR libintl.h) + if(GETTEXT_INCLUDE_DIR) + set(HAVE_LIBINTL_H 1) + else(GETTEXT_INCLUDE_DIR) + set(HAVE_LIBINTL_H 0) + endif(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 ) + find_library(LIBINTL_LIBRARY NAMES intl libintl ) - CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) + check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) if (LIBINTL_HAS_DGETTEXT) set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) @@ -59,7 +62,7 @@ else (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) endif (Gettext_FIND_REQUIRED) endif (GETTEXT_FOUND) - MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) + mark_as_advanced(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) endif (LIBC_HAS_DGETTEXT OR LIBINTL_HAS_DGETTEXT) -- cgit v1.2.1