New way to connect a job_t.
[apps/madmutt.git] / po / CMakeLists.txt
1 FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
2 FIND_PROGRAM(MSGMERGE_EXECUTABLE msgmerge)
3 FIND_PROGRAM(MSGFMT_EXECUTABLE msgfmt)
4
5 SET(POT_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/madmutt.pot)
6
7 FILE(GLOB _pofiles *.po)
8
9 ADD_CUSTOM_TARGET(update-po
10     WORKING_DIRECTORY ${madmutt_SOURCE_DIR}
11     COMMAND ${XGETTEXT_EXECUTABLE} -Lc -k_ -kN_ -o${POT_OUTPUT} -f${CMAKE_CURRENT_SOURCE_DIR}/POTFILES
12 )
13
14 FOREACH(_file ${_pofiles})
15     GET_FILENAME_COMPONENT(_file_we ${_file} NAME_WE)
16     SET(_in  ${_file_we}.po)
17     SET(_abs ${CMAKE_CURRENT_SOURCE_DIR}/${_in})
18     SET(_out ${CMAKE_CURRENT_BINARY_DIR}/${_file_we}.gmo)
19
20     ADD_CUSTOM_TARGET(${_in}
21         COMMAND ${MSGMERGE_EXECUTABLE} -q -U --backup=none -s ${_file} ${POT_OUTPUT}
22     )
23
24     ADD_CUSTOM_COMMAND(
25         OUTPUT ${_out}
26         COMMAND ${MSGFMT_EXECUTABLE} -o ${_out} ${_abs}
27         DEPENDS ${_abs}
28     )
29
30     INSTALL(
31         FILES ${_file}
32         DESTINATION share/locale/${_file_we}/LC_MESSAGES/
33         RENAME madmutt.mo
34     )
35
36     SET(_gmofiles ${_gmofiles} ${_out})
37     ADD_DEPENDENCIES(update-po ${_in})
38 ENDFOREACH(_file)
39
40 ADD_CUSTOM_TARGET(translations ALL DEPENDS ${_gmofiles})