Skip to content
Snippets Groups Projects
Commit 744e7881 authored by Julien Malik's avatar Julien Malik
Browse files

ENH: first draft for FindGettext.cmake FindGettextLib.cmake FindICUUC.cmake FindLTDL.cmake

parent 27ea9b1d
Branches
Tags
No related merge requests found
# - 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.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
# make it a real variable, so we can modify it here
SET(_firstPoFile "${_firstPoFileArg}")
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 ${_firstPoFile} ${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 )
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 )
# - Find GETTEXT
# Find the native GETTEXT includes and library
#
# GETTEXT_FOUND - True if GETTEXT found.
# GETTEXT_INCLUDE_DIRS - where to find tinyxml.h, etc.
# GETTEXT_LIBRARIES - List of libraries when using GETTEXT.
#
IF( GETTEXT_INCLUDE_DIR )
# Already in cache, be silent
SET( GETTEXT_FIND_QUIETLY TRUE )
ENDIF( GETTEXT_INCLUDE_DIR )
FIND_PATH( GETTEXT_INCLUDE_DIR libintl.h )
FIND_LIBRARY( GETTEXT_LIBRARY
NAMES GETTEXT )
# handle the QUIETLY and REQUIRED arguments and set GETTEXT_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( GETTEXT DEFAULT_MSG GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY )
MARK_AS_ADVANCED( GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY )
IF(GETTEXT_FOUND)
SET(GETTEXT_INCLUDE_DIRS ${GETTEXT_INCLUDE_DIR})
SET(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
ELSE(GETTEXT_FOUND)
SET(GETTEXT_INCLUDE_DIRS)
SET(GETTEXT_LIBRARIES)
ENDIF(GETTEXT_FOUND)
# - Find ICUUC
# Find the native ICUUC includes and library
#
# ICUUC_FOUND - True if ICUUC found.
# ICUUC_INCLUDE_DIRS - where to find tinyxml.h, etc.
# ICUUC_LIBRARIES - List of libraries when using ICUUC.
#
IF( ICUUC_INCLUDE_DIR )
# Already in cache, be silent
SET( ICUUC_FIND_QUIETLY TRUE )
ENDIF( ICUUC_INCLUDE_DIR )
FIND_PATH( ICUUC_INCLUDE_DIR unicode/unistr.h )
FIND_LIBRARY( ICUUC_LIBRARY
NAMES icuuc )
# handle the QUIETLY and REQUIRED arguments and set ICUUC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( ICUUC DEFAULT_MSG ICUUC_INCLUDE_DIR ICUUC_LIBRARY )
MARK_AS_ADVANCED( ICUUC_INCLUDE_DIR ICUUC_LIBRARY )
IF(ICUUC_FOUND)
SET(ICUUC_INCLUDE_DIRS ${ICUUC_INCLUDE_DIR})
SET(ICUUC_LIBRARIES ${ICUUC_LIBRARY})
ELSE(ICUUC_FOUND)
SET(ICUUC_INCLUDE_DIRS)
SET(ICUUC_LIBRARIES)
ENDIF(ICUUC_FOUND)
# - Find LTDL
# Find the native LTDL includes and library
#
# LTDL_FOUND - True if LTDL found.
# LTDL_INCLUDE_DIRS - where to find tinyxml.h, etc.
# LTDL_LIBRARIES - List of libraries when using LTDL.
#
IF( LTDL_INCLUDE_DIR )
# Already in cache, be silent
SET( LTDL_FIND_QUIETLY TRUE )
ENDIF( LTDL_INCLUDE_DIR )
FIND_PATH( LTDL_INCLUDE_DIR ltdl.h )
FIND_LIBRARY( LTDL_LIBRARY
NAMES ltdl )
# handle the QUIETLY and REQUIRED arguments and set LTDL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( LTDL DEFAULT_MSG LTDL_INCLUDE_DIR LTDL_LIBRARY )
MARK_AS_ADVANCED( LTDL_INCLUDE_DIR LTDL_LIBRARY )
IF(LTDL_FOUND)
SET(LTDL_INCLUDE_DIRS ${LTDL_INCLUDE_DIR})
SET(LTDL_LIBRARIES ${LTDL_LIBRARY})
ELSE(LTDL_FOUND)
SET(LTDL_INCLUDE_DIRS)
SET(LTDL_LIBRARIES)
ENDIF(LTDL_FOUND)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment