lyx_mirror/po/CreateLayoutTranslations.cmake
Kornel Benko cbd4e332f7 Cmake build: Make missing polib less destructive.
Configure still whines, but proceeds succesfull.
Only the target 'layouttranslations1' will fail.
2016-07-27 07:34:50 +02:00

44 lines
1.4 KiB
CMake

# 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)
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}"
RESULT_VARIABLE _err)
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)
die_if(_err "Copy of layouttranslations to source failed")