2011-07-21 12:33:29 +02:00
|
|
|
# Package finder for gettext libs and include files
|
|
|
|
|
|
|
|
SET(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
|
|
|
|
CACHE FILEPATH "path to custom gettext")
|
|
|
|
|
|
|
|
# by default
|
|
|
|
SET(GETTEXT_FOUND FALSE)
|
|
|
|
|
|
|
|
FIND_PATH(GETTEXT_INCLUDE_DIR
|
|
|
|
NAMES libintl.h
|
|
|
|
PATHS "${CUSTOM_GETTEXT_PATH}/include"
|
|
|
|
DOC "gettext include directory")
|
|
|
|
|
|
|
|
FIND_PROGRAM(GETTEXT_MSGFMT
|
|
|
|
NAMES msgfmt
|
|
|
|
PATHS "${CUSTOM_GETTEXT_PATH}/bin"
|
|
|
|
DOC "path to msgfmt")
|
|
|
|
|
2011-07-22 10:55:05 +02:00
|
|
|
FIND_PROGRAM(GETTEXT_MSGMERGE
|
|
|
|
NAMES msgmerge
|
|
|
|
PATHS "${CUSTOM_GETTEXT_PATH}/bin"
|
|
|
|
DOC "path to msgmerge")
|
|
|
|
|
|
|
|
FIND_PROGRAM(GETTEXT_MSGEN
|
|
|
|
NAMES msgen
|
|
|
|
PATHS "${CUSTOM_GETTEXT_PATH}/bin"
|
|
|
|
DOC "path to msgen")
|
|
|
|
|
|
|
|
FIND_PROGRAM(GETTEXT_EXTRACT
|
|
|
|
NAMES xgettext
|
|
|
|
PATHS "${CUSTOM_GETTEXT_PATH}/bin"
|
|
|
|
DOC "path to xgettext")
|
|
|
|
|
2011-07-21 12:33:29 +02:00
|
|
|
# modern Linux, as well as Mac, seem to not need require special linking
|
2011-07-21 13:24:37 +02:00
|
|
|
# they do not because gettext is part of glibc
|
2011-07-21 12:33:29 +02:00
|
|
|
# TODO check the requirements on other BSDs and older Linux
|
|
|
|
IF (WIN32)
|
2011-07-21 14:50:15 +02:00
|
|
|
IF(MSVC)
|
|
|
|
SET(GETTEXT_LIB_NAMES
|
|
|
|
libintl.lib intl.lib libintl3.lib intl3.lib)
|
|
|
|
ELSE()
|
|
|
|
SET(GETTEXT_LIB_NAMES
|
|
|
|
libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a)
|
|
|
|
ENDIF()
|
2011-07-21 12:33:29 +02:00
|
|
|
FIND_LIBRARY(GETTEXT_LIBRARY
|
2011-07-21 14:50:15 +02:00
|
|
|
NAMES ${GETTEXT_LIB_NAMES}
|
2011-07-21 12:33:29 +02:00
|
|
|
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
|
|
|
|
DOC "gettext *intl*.lib")
|
2011-07-21 16:21:01 +02:00
|
|
|
FIND_FILE(GETTEXT_DLL
|
2011-07-21 12:33:29 +02:00
|
|
|
NAMES libintl.dll intl.dll libintl3.dll intl3.dll
|
2011-07-21 13:24:37 +02:00
|
|
|
PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
|
2011-07-21 12:33:29 +02:00
|
|
|
DOC "gettext *intl*.dll")
|
2011-07-21 16:21:01 +02:00
|
|
|
FIND_FILE(GETTEXT_ICONV_DLL
|
2011-07-21 12:33:29 +02:00
|
|
|
NAMES libiconv2.dll
|
2011-07-21 13:24:37 +02:00
|
|
|
PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
|
2011-07-21 12:33:29 +02:00
|
|
|
DOC "gettext *iconv*.lib")
|
|
|
|
ENDIF(WIN32)
|
|
|
|
|
|
|
|
|
|
|
|
IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT)
|
|
|
|
IF (WIN32)
|
|
|
|
# in the Win32 case check also for the extra linking requirements
|
|
|
|
IF(GETTEXT_LIBRARY AND GETTEXT_DLL AND GETTEXT_ICONV_DLL)
|
|
|
|
SET(GETTEXT_FOUND TRUE)
|
|
|
|
ENDIF()
|
|
|
|
ELSE(WIN32)
|
|
|
|
SET(GETTEXT_FOUND TRUE)
|
|
|
|
ENDIF(WIN32)
|
|
|
|
ENDIF()
|
|
|
|
|
2011-07-22 09:36:17 +02:00
|
|
|
IF(GETTEXT_FOUND)
|
|
|
|
SET(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
|
|
|
|
SET(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
|
|
|
|
SET(GETTEXT_MO_DEST_PATH locale/<locale>/LC_MESSAGES)
|
|
|
|
FILE(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
|
|
|
|
MACRO(SET_MO_PATHS _buildvar _destvar _locale)
|
|
|
|
STRING(REPLACE "<locale>" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH})
|
|
|
|
STRING(REPLACE "<locale>" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH})
|
|
|
|
ENDMACRO(SET_MO_PATHS)
|
2011-07-23 22:36:11 +02:00
|
|
|
ELSE()
|
|
|
|
SET(GETTEXT_INCLUDE_DIR "")
|
|
|
|
SET(GETTEXT_LIBRARY "")
|
2011-07-22 09:36:17 +02:00
|
|
|
ENDIF()
|