From 16f08b6a989a2d818e860f641ad417cfd49fed4f Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 19 Oct 2015 12:11:35 +0300 Subject: [PATCH] GettextCommonRules.cmake added. --- GettextCommonRules.cmake | 36 ++++++++++++++++++++++++++++++++++++ ValaBinCommonRules.cmake | 2 +- ValaLibCommonRules.cmake | 2 +- ValaPluginCommonRules.cmake | 2 +- 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 GettextCommonRules.cmake diff --git a/GettextCommonRules.cmake b/GettextCommonRules.cmake new file mode 100644 index 0000000..90cbaeb --- /dev/null +++ b/GettextCommonRules.cmake @@ -0,0 +1,36 @@ +SET (GETTEXT_PACKAGE "${PROJECT_LOWERCASE_NAME}-${MAJOR}") +ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}") + +# FIXME: Custom locale directory +IF (WIN32) + SET (LOCALEDIR "") +ELSE () + SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale") +ENDIF () +SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into") +IF (NOT CUSTOM_LOCALEDIR STREQUAL "") + SET (LOCALEDIR "${CUSTOM_LOCALEDIR}") + MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}") +ENDIF () +ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}") +SET (LOCALE_INSTALL_DIR "share/locale") + +# by all langs +INCLUDE (MacroOptionalAddSubdirectory) +FIND_PACKAGE (Gettext REQUIRED) +MACRO_OPTIONAL_ADD_SUBDIRECTORY (langs) + +# configure a header file for Gettext +STRING (TOUPPER "${CMAKE_PROJECT_NAME}" GettextUniqueHeader) +CONFIGURE_FILE ( + "gettext-config.h.in" + "${PROJECT_BINARY_DIR}/po/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) diff --git a/ValaBinCommonRules.cmake b/ValaBinCommonRules.cmake index b03137a..b33c7d0 100644 --- a/ValaBinCommonRules.cmake +++ b/ValaBinCommonRules.cmake @@ -1,6 +1,6 @@ INCLUDE (FindVala) INCLUDE (UseVala) -INCLUDE (CFlags) +INCLUDE (CFlagsCommonRules) FIND_PACKAGE (PkgConfig REQUIRED) SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/run") # Avoid of "dll not found" messages diff --git a/ValaLibCommonRules.cmake b/ValaLibCommonRules.cmake index 2c67181..06835d9 100644 --- a/ValaLibCommonRules.cmake +++ b/ValaLibCommonRules.cmake @@ -1,6 +1,6 @@ INCLUDE (FindVala) INCLUDE (UseVala) -INCLUDE (CFlags) +INCLUDE (CFlagsCommonRules) FIND_PACKAGE (PkgConfig REQUIRED) IF (WIN32) diff --git a/ValaPluginCommonRules.cmake b/ValaPluginCommonRules.cmake index 93b64f7..407f6aa 100644 --- a/ValaPluginCommonRules.cmake +++ b/ValaPluginCommonRules.cmake @@ -1,6 +1,6 @@ INCLUDE (FindVala) INCLUDE (UseVala) -INCLUDE (CFlags) +INCLUDE (CFlagsCommonRules) FIND_PACKAGE (PkgConfig REQUIRED) VALA_PRECOMPILE (VALA_C ${PluginSources}