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 # -DWORKDIR=${BUILD_DIR}/autotests/out-home \
14 # -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake"
17 string(RANDOM LENGTH 5 errorfile)
18 string(RANDOM LENGTH 6 outputfile)
19 message(STATUS "Executing ${LYX2LYX} -e ${errorfile} -o ${outputfile} ${LYXFILE}")
21 COMMAND ${LYX2LYX} -e ${errorfile} -o ${outputfile} ${LYXFILE}
24 message(STATUS "Error output of lyx2lyx = ${_err}")
25 string(COMPARE NOTEQUAL ${_err} 0 _erg)
27 # Check file "errors" being empty
28 file(STRINGS ${errorfile} foundErrors)
31 foreach(_l ${foundErrors})
32 message(STATUS "${_l}")
36 # Check the output-file being not empty
37 file(STRINGS ${outputfile} createdLyx)
40 message(STATUS "Created file empty")
43 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${errorfile} ${outputfile})
45 message(FATAL_ERROR "lyx2lyx failed")