set(LANGS
cs
sk
)

# Only compile .po to .gmo. Unlike gettext_create_translations() this never
# runs msgmerge --update on the source .po files; merging with dxirc.pot is
# done by updatepo.sh.
if(GETTEXT_MSGFMT_EXECUTABLE)
    set(gmo_files)
    foreach(lang ${LANGS})
        set(po_file "${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po")
        set(gmo_file "${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo")
        add_custom_command(OUTPUT ${gmo_file}
            COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${gmo_file} ${po_file}
            DEPENDS ${po_file}
        )
        install(FILES ${gmo_file} DESTINATION share/locale/${lang}/LC_MESSAGES RENAME dxirc.mo)
        list(APPEND gmo_files ${gmo_file})
    endforeach(lang)
    add_custom_target(translations ALL DEPENDS ${gmo_files})
endif(GETTEXT_MSGFMT_EXECUTABLE)
