]> git.lyx.org Git - features.git/blob - development/cmake/po/CMakeLists.txt
Kornel's cmake install changes:
[features.git] / development / cmake / po / CMakeLists.txt
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2008, Peter Kümmel, <syntheticpp@gmx.net>
5 #                   , Kornel Benko, <Kornel.Benko@berlin.de>
6 #
7
8 project(lyx)
9
10 include_directories(${TOP_SRC_DIR}/po)
11
12 SET(_py_sources)
13 macro(add_gettext_python  _par _dir)
14   file(GLOB _sources ${TOP_SRC_DIR}/${_dir}/${ARGN})
15   SET(_dst "${CMAKE_CURRENT_BINARY_DIR}/${_par}_l10n.pot")
16   ADD_CUSTOM_COMMAND(
17     OUTPUT "${_dst}"
18     PRE_BUILD
19     COMMAND python
20     ARGS "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${_par} ${_sources}
21     DEPENDS ${_sources}
22     )
23   SET_SOURCE_FILES_PROPERTIES("${_dst}" GENERATED)
24   LIST(APPEND _py_sources "${_dst}")
25 endmacro(add_gettext_python)
26
27 SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot" GENERATED)
28 SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot" GENERATED)
29 SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/lyx.pot" GENERATED)
30
31 add_gettext_python(encodings lib encodings)
32 add_gettext_python(external lib external_templates)
33 add_gettext_python(formats lib configure.py)
34 add_gettext_python(languages lib languages)
35 add_gettext_python(layouts lib/layouts *.layouts *.inc *.module)
36 add_gettext_python(qt4 src/frontends/qt4/ui *.ui)
37 add_gettext_python(ui lib/ui *.ui *.inc)
38
39 FIND_PROGRAM(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
40 FIND_PROGRAM(GETTEXT_MSGUNIQ_EXECUTABLE msguniq)
41
42 # TODO:
43 #         We need here perl, because I don't know how
44 #         to write the alternative for "cat" in python
45 #         e.g. perl -e "\"while(<>){print;}\""
46 # But maybe Jose knows?
47
48 ADD_CUSTOM_COMMAND(
49     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot"
50     COMMAND perl
51     ARGS -e "\"while(<>){print;}\"" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot"
52     DEPENDS ${_py_sources}
53     )
54
55 ADD_CUSTOM_COMMAND(
56     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot"
57     COMMAND ${GETTEXT_MSGUNIQ_EXECUTABLE}
58     ARGS -o "${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot"
59     DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/lyx.cat.pot"
60     )
61
62 file(STRINGS "${TOP_SRC_DIR}/po/POTFILES.in" _tmppotfiles_dep)
63 SET(_potfiles_dep)
64 foreach(_f ${_tmppotfiles_dep})
65   LIST(APPEND _potfiles_dep "${TOP_SRC_DIR}/${_f}")
66 endforeach(_f)
67
68 ADD_CUSTOM_COMMAND(
69     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/lyx.pot"
70     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/lyx.pot"
71     COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
72     ARGS --default-domain=lyx --directory=${TOP_SRC_DIR} --add-comments=TRANSLATORS: --language=C++ --join-existing --keyword=_ --keyword=N_ --keyword=B_ --keyword=qt_ --files-from="${TOP_SRC_DIR}/po/POTFILES.in" --copyright-holder='LyX Developers' --msgid-bugs-address=lyx-devel@lists.lyx.org -o "${CMAKE_CURRENT_BINARY_DIR}/lyx.pot"
73     DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/lyx.fmt.pot" ${_potfiles_dep}
74     )
75
76 file(GLOB LYX_PO_FILES ${TOP_SRC_DIR}/po/*.po)
77
78 GETTEXT_CREATE_TRANSLATIONS(${CMAKE_CURRENT_BINARY_DIR}/lyx.pot ALL ${LYX_PO_FILES})
79
80 # ADD_POFILES("lyx")
81