File: I18n.cmake

package info (click to toggle)
evolution-data-server 3.56.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 46,656 kB
  • sloc: ansic: 365,352; xml: 578; cpp: 482; perl: 297; sh: 62; makefile: 60; python: 35; javascript: 29
file content (26 lines) | stat: -rw-r--r-- 743 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# I18n.cmake
#
# Macros to easily use Gettext translations capabilities
#

include(FindGettext)
include(CMakeParseArguments)

macro(i18n_merge_file _source _target _po_dir)
	cmake_parse_arguments(_I18N "" "TYPE" "EXTRA_ARGS" ${ARGN})
	if (NOT DEFINED _I18N_TYPE)
		set(_I18N_TYPE "desktop")
	elseif(NOT ((${_I18N_TYPE} STREQUAL "desktop") OR (${_I18N_TYPE} STREQUAL "xml")))
		message(FATAL_ERROR "Wrong type supplied, only 'desktop' and 'xml' are allowed, given: '${_I18N_TYPE}'")
	endif()
	add_custom_command(
		OUTPUT ${_target}
		DEPENDS ${_source} "${_po_dir}/LINGUAS"
		COMMAND ${GETTEXT_MSGFMT_EXECUTABLE}
			--${_I18N_TYPE}
			--template=${_source}
			-d ${_po_dir}
			-o ${_target}
			${_I18N_EXTRA_ARGS}
	)
endmacro(i18n_merge_file)