cmake.backbone/GettextCommonRules.cmake

31 lines
1.0 KiB
CMake

SET (GETTEXT_PACKAGE "${PROJECT_LOWERCASE_NAME}-${MAJOR}")
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
FIND_PACKAGE (Gettext REQUIRED)
# Custom locale directory
SET (LOCALEDIR "share/locale" CACHE STRING "Directory to install l10n files into")
MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}")
# for each language
INCLUDE (MacroSubdirList)
SUBDIRLIST (SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
FOREACH (subdir ${SUBDIRS})
ADD_SUBDIRECTORY (${subdir})
ENDFOREACH()
# configure a header file for Gettext
STRING (TOUPPER "${CMAKE_PROJECT_NAME}" GettextUniqueHeader)
CONFIGURE_FILE (
"${CMAKE_SOURCE_DIR}/cmake/backbone/templates/gettext-config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/gettext-config.h"
)
# check for msgmerge utility
IF (NOT GETTEXT_MSGMERGE_EXECUTABLE)
MESSAGE (FATAL_ERROR "Please install msgmerge binary")
ENDIF (NOT GETTEXT_MSGMERGE_EXECUTABLE)
IF (NOT GETTEXT_MSGFMT_EXECUTABLE)
MESSAGE(FATAL_ERROR "Please install msgmerge binary")
ENDIF (NOT GETTEXT_MSGFMT_EXECUTABLE)