cmake: add gettext support

This commit is contained in:
David Adam 2017-11-16 21:33:35 +08:00
parent 7e24c14f8c
commit 32714021f5
4 changed files with 23 additions and 4 deletions

View file

@ -59,6 +59,7 @@ SET(FBVF "FISH-BUILD-VERSION-FILE")
# Set up config.h
INCLUDE(cmake/ConfigureChecks.cmake)
INCLUDE(cmake/gettext.cmake)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config_cmake.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

View file

@ -84,4 +84,3 @@ ENDIF()
CHECK_TYPE_SIZE("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX)
# Not checked yet: non-varargs tparm ("Solaris tparm kludge")
# Not checked yet: gettext

22
cmake/gettext.cmake Normal file
View file

@ -0,0 +1,22 @@
SET(languages de en fr nb nn pl pt_BR sv zh_CN)
INCLUDE(FeatureSummary)
OPTION(WITH_GETTEXT "translate messages if gettext is available" ON)
IF(WITH_GETTEXT)
FIND_PACKAGE(Intl)
FIND_PACKAGE(Gettext)
IF(GETTEXT_FOUND)
SET(HAVE_GETTEXT 1)
ENDIF()
ENDIF()
ADD_FEATURE_INFO(gettext GETTEXT_FOUND "translate messages with gettext")
# Define translations
IF(GETTEXT_FOUND)
FOREACH(lang ${languages})
GETTEXT_PROCESS_PO_FILES(${lang} ALL
INSTALL_DESTINATION ${CMAKE_INSTALL_FULL_LOCALEDIR}
PO_FILES po/${lang}.po)
ENDFOREACH()
ENDIF()

View file

@ -139,9 +139,6 @@
/* Define to 1 if tparm accepts a fixed amount of paramters. */
// #cmakedefine TPARM_SOLARIS_KLUDGE 1
/* Perform string translations with gettext */
// #cmakedefine USE_GETTEXT 1
/* The size of wchar_t in bits. */
#define WCHAR_T_BITS ${WCHAR_T_BITS}