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