1 FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
3 IF(NOT GETTEXT_MSGFMT_EXECUTABLE)
6 NOTE: msgfmt not found. Translations will *not* be installed
8 ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE)
12 ADD_CUSTOM_TARGET(translations ALL)
14 FILE(GLOB PO_FILES *.po)
16 FOREACH(_poFile ${PO_FILES})
17 GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
18 STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} )
19 STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
22 GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
23 SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
25 ADD_CUSTOM_COMMAND(TARGET translations
26 COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
28 INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
31 ENDFOREACH(_poFile ${PO_FILES})
33 ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE)