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 -DLYX2LYX=xxx \
12 # -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
13 # -DWORKDIR=${BUILD_DIR}/autotests/out-home \
15 # -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake"
18 string(RANDOM LENGTH 5 errorfile)
19 string(RANDOM LENGTH 6 outputfile)
20 message(STATUS "Executing ${LYX2LYX} -e ${errorfile} -o ${outputfile} ${LYXFILE}")
22 COMMAND ${LYX2LYX} -e ${errorfile} -o ${outputfile} ${LYXFILE}
25 message(STATUS "Error output of lyx2lyx = ${_err}")
26 string(COMPARE NOTEQUAL ${_err} 0 _erg)
28 # Check file "errors" being empty
29 file(STRINGS ${errorfile} foundErrors)
32 foreach(_l ${foundErrors})
33 message(STATUS "${_l}")
37 # Check the output-file being not empty
38 file(STRINGS ${outputfile} createdLyx)
41 message(STATUS "Created file empty")
44 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${errorfile} ${outputfile})
46 message(FATAL_ERROR "lyx2lyx failed")