X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=po%2FCreateLayoutTranslations.cmake;h=1eff48a734f54e6057bc10f656af2a78e0a22aed;hb=d1a678563e5e8183452fe85db4e37b9ad01c7c94;hp=22e3a529b38eef3f1710a063d181cd1d5a261dc8;hpb=40597c3be9c7920774f7f3216f06ec86558d30da;p=lyx.git diff --git a/po/CreateLayoutTranslations.cmake b/po/CreateLayoutTranslations.cmake index 22e3a529b3..1eff48a734 100644 --- a/po/CreateLayoutTranslations.cmake +++ b/po/CreateLayoutTranslations.cmake @@ -1,34 +1,47 @@ -# -DTOP_SRC_DIR=xxx \ -# -DDestFile=xxx \ -# -DLYX_PYTHON_EXECUTABLE=xxx \ -# -DParType=xxx \ -# -DSources=xxx \ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2016 Kornel Benko kornel@lyx.org +# +# Script should be called like: +# cmake -DTOP_SRC_DIR=xxx \ +# -DDestFile=xxx \ +# -DLYX_PYTHON_EXECUTABLE=xxx \ +# -DParType=xxx \ +# -DSources=xxx \ +# -DLYX_PY_POLIB=${LYX_PY_POLIB} \ +# -P "${TOP_SRC_DIR}/po/CreateLayoutTranslations.cmake" set(_dst ${DestFile}) set(type ${ParType}) set(_src_files ${Sources}) +macro(die_if _err text) + string(COMPARE EQUAL ${${_err}} 0 _erg) + if(NOT _erg) + message(FATAL_ERROR "CreateLayoutTranslations: ${text}") + endif() +endmacro() + message(STATUS "Starting CreateLayoutTranslations") +if ("${LYX_PY_POLIB}" STREQUAL "") + message(STATUS "Missing needed pythons polib, be prepared for error") +endif() execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${TOP_SRC_DIR}/lib/layouttranslations" "${_dst}" RESULT_VARIABLE _err) -string(COMPARE EQUAL ${_err} 0 _erg) -if(NOT _erg) - message(FATAL_ERROR "CreateLayoutTranslations: Copy of layouttranslations failed") -endif() +die_if(_err "Copy of layouttranslations failed") execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${type} "--src_file=${_src_files}" + OUTPUT_VARIABLE _err_out RESULT_VARIABLE _err) - -string(COMPARE EQUAL ${_err} 0 _erg) -if(NOT _erg) - message(FATAL_ERROR "CreateLayoutTranslations: Calling python wit errors") +if(_err) + message(STATUS "${_err_out}") endif() +die_if(_err "Calling lyx_pot.py failed") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_dst}" "${TOP_SRC_DIR}/lib/layouttranslations" RESULT_VARIABLE _err) -if(NOT _erg) - message(FATAL_ERROR "CreateLayoutTranslations: Copy of layouttranslations to source failed") -endif() +die_if(_err "Copy of layouttranslations to source failed")