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}