Browse Source

Gettext rules updated.

master
Kolan Sh 6 years ago
parent
commit
dd44f3f616
  1. 28
      GettextCommonRules.cmake
  2. 3
      GettextLangRules.cmake
  3. 10
      MacroSubdirList.cmake
  4. 2
      ValaBinCommonRules.cmake
  5. 2
      ValaLibCommonRules.cmake
  6. 2
      ValaPluginCommonRules.cmake

28
GettextCommonRules.cmake

@ -1,30 +1,24 @@
SET (GETTEXT_PACKAGE "${PROJECT_LOWERCASE_NAME}-${MAJOR}")
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
FIND_PACKAGE (Gettext REQUIRED)
# 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 ()
# Custom locale directory
SET (LOCALEDIR "share/locale" CACHE STRING "Directory to install l10n files into")
MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}")
SET (LOCALE_INSTALL_DIR "share/locale")
# by all langs
INCLUDE (MacroOptionalAddSubdirectory)
FIND_PACKAGE (Gettext REQUIRED)
MACRO_OPTIONAL_ADD_SUBDIRECTORY (langs)
# 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 (
"gettext-config.h.in"
"${PROJECT_BINARY_DIR}/po/gettext-config.h"
"${CMAKE_CURRENT_BINARY_DIR}/gettext-config.h"
)
# check for msgmerge utility

3
GettextLangRules.cmake

@ -0,0 +1,3 @@
FILE (GLOB _po_files *.po)
GET_FILENAME_COMPONENT (LANG "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
GETTEXT_PROCESS_PO_FILES ("${LANG}" ALL INSTALL_DESTINATION ${LOCALEDIR} PO_FILES ${_po_files} )

10
MacroSubdirList.cmake

@ -0,0 +1,10 @@
MACRO(SUBDIRLIST result curdir)
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
SET(dirlist "")
FOREACH(child ${children})
IF(IS_DIRECTORY ${curdir}/${child})
LIST(APPEND dirlist ${child})
ENDIF()
ENDFOREACH()
SET(${result} ${dirlist})
ENDMACRO()

2
ValaBinCommonRules.cmake

@ -13,7 +13,7 @@ VALA_PRECOMPILE (VALA_C ${BinSources}
GENERATE_HEADER
)
PKG_CHECK_MODULES (PKGS REQUIRED ${BinPkgModules})
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
ADD_EXECUTABLE (${BinName} ${VALA_C} ${BinExtraSources})
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
TARGET_LINK_LIBRARIES (${BinName} ${PKGS_LIBRARIES} ${BinLinkLibs})

2
ValaLibCommonRules.cmake

@ -15,7 +15,7 @@ VALA_PRECOMPILE (VALA_C ${LibSources}
GENERATE_HEADER ${LibName}-${MAJOR}
)
PKG_CHECK_MODULES (PKGS REQUIRED ${LibPkgModules})
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
ADD_LIBRARY (${LibName} SHARED ${VALA_C} ${LibExtraSources})
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
TARGET_LINK_LIBRARIES (${LibName} ${PKGS_LIBRARIES} ${LibLinkLibs})

2
ValaPluginCommonRules.cmake

@ -11,7 +11,7 @@ VALA_PRECOMPILE (VALA_C ${PluginSources}
GENERATE_HEADER
)
PKG_CHECK_MODULES (PKGS REQUIRED ${PluginPkgModules})
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS})
INCLUDE_DIRECTORIES (${PKGS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/po)
ADD_LIBRARY (${PluginName} SHARED ${VALA_C} ${PluginExtraSources})
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${PROJECT_LOWERCASE_NAME}-${MAJOR}")
TARGET_LINK_LIBRARIES (${PluginName} ${PKGS_LIBRARIES} ${PluginLinkLibs})
Loading…
Cancel
Save