1 find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
3 if(NOT GETTEXT_MSGFMT_EXECUTABLE)
4 message("NOTE: msgfmt not found. Translations will *not* be installed")
5 else(NOT GETTEXT_MSGFMT_EXECUTABLE)
8 file(GLOB PO_FILES *.po)
10 foreach(_poFile ${PO_FILES})
11 message("Found translation: ${_poFile}")
12 get_filename_component(_lang ${_poFile} NAME_WE)
13 set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
15 add_custom_command(OUTPUT ${_gmoFile}
16 COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
18 add_custom_target(translation-${_lang} ALL DEPENDS ${_gmoFile})
19 install(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES/ RENAME ${catalogname}.mo)
20 endforeach(_poFile ${PO_FILES})
21 endif(NOT GETTEXT_MSGFMT_EXECUTABLE)