1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
4 # Copyright (c) 2016 Kornel Benko kornel@lyx.org
6 # Script should be called like:
7 # cmake -DTOP_SRC_DIR=xxx \
9 # -DLYX_PYTHON_EXECUTABLE=xxx \
12 # -DLYX_PY_POLIB=${LYX_PY_POLIB} \
13 # -P "${TOP_SRC_DIR}/po/CreateLayoutTranslations.cmake"
17 set(_src_files ${Sources})
19 macro(die_if _err text)
20 string(COMPARE EQUAL ${${_err}} 0 _erg)
22 message(FATAL_ERROR "CreateLayoutTranslations: ${text}")
26 message(STATUS "Starting CreateLayoutTranslations")
27 if ("${LYX_PY_POLIB}" STREQUAL "")
28 message(STATUS "Missing needed pythons polib, be prepared for error")
30 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${TOP_SRC_DIR}/lib/layouttranslations" "${_dst}"
32 die_if(_err "Copy of layouttranslations failed")
34 execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE}
35 "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${type}
36 "--src_file=${_src_files}"
38 die_if(_err "Calling lyx_pot.py failed")
40 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_dst}" "${TOP_SRC_DIR}/lib/layouttranslations"
42 die_if(_err "Copy of layouttranslations to source failed")