File: CMakeLists.txt

package info (click to toggle)
kup-backup 0.7.1+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,480 kB
  • sloc: cpp: 7,263; sh: 51; makefile: 6
file content (30 lines) | stat: -rw-r--r-- 1,082 bytes parent folder | download
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
27
28
29
30
FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)

IF(NOT GETTEXT_MSGFMT_EXECUTABLE)
	MESSAGE(
"------
                 NOTE: msgfmt not found. Translations will *not* be installed
------")
ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE)
	SET(catalogname kup)

	ADD_CUSTOM_TARGET(translations ALL)

	FILE(GLOB PO_FILES *.po)

	FOREACH(_poFile ${PO_FILES})
		GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
		STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} )
		STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )

		IF( _langCode )
			GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
			SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)

			ADD_CUSTOM_COMMAND(TARGET translations
			                   COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check-header --check-domain -o ${_gmoFile} ${_poFile}
			                   DEPENDS ${_poFile})
			                   INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
		ENDIF( _langCode )
	ENDFOREACH(_poFile ${PO_FILES})
ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE)