1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
4 # Copyright (c) 2013 Kornel Benko kornel@lyx.org
7 # LYX2LYX = ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx
10 # Script should be called like:
11 # cmake -DLYX_PYTHON_EXECUTABLE=xxx \
13 # -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
14 # -DWORKDIR=${BUILD_DIR}/autotests/out-home \
16 # -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake"
19 string(RANDOM LENGTH 5 errorfile)
20 string(RANDOM LENGTH 6 outputfile)
21 message(STATUS "Executing ${LYX_PYTHON_EXECUTABLE} ${LYX2LYX} -e ${errorfile} -o ${outputfile} ${LYXFILE}")
23 COMMAND ${LYX_PYTHON_EXECUTABLE} ${LYX2LYX} -e ${errorfile} -o ${outputfile} ${LYXFILE}
26 message(STATUS "Error output of lyx2lyx = ${_err}")
27 string(COMPARE NOTEQUAL ${_err} 0 _erg)
29 # Check file "errors" being empty
30 file(STRINGS ${errorfile} foundErrors)
32 foreach(_l ${foundErrors})
33 if (NOT _l MATCHES "lyx2lyx warning: No conversion needed:")
35 message(STATUS "${_l}")
40 # Check the output-file being not empty
41 file(STRINGS ${outputfile} createdLyx)
44 message(STATUS "Created file empty")
47 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${errorfile} ${outputfile})
49 message(FATAL_ERROR "lyx2lyx failed")