Use std::vector<>::back() to make the code more readable.
[tagua/yd.git] / translations / CMakeLists.txt
blobeb5dada3ce032ba0a9c666d0db04ab7890f194e1
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)
6   set(catalogname tagua) 
7   
8   file(GLOB PO_FILES *.po)
9   
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)
14     
15     add_custom_command(OUTPUT ${_gmoFile}
16             COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
17             DEPENDS ${_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)