]> git.lyx.org Git - lyx.git/blob - development/autotests/export.cmake
75ef3d645b3a745eafc68abb8a83dd1a3196b53e
[lyx.git] / development / autotests / export.cmake
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2012 Kornel Benko kornel@lyx.org
5 #
6 #
7 # LYX_ROOT  = ${TOP_SRC_DIR}/lib/{doc,examples,templates}
8 # lyx       = 
9 # format    = lyx16x|xhtml
10 # extension = 16.lyx|xhtml
11 # file      = xxx
12 #
13 # Script should be called like:
14 # cmake -DLYX_ROOT=xxx \
15 #       -DWORKDIR=${BUILD_DIR}/autotests/out-home
16 #       -Dlyx=xxx \
17 #       -Dformat=xxx \
18 #       -Dextension=xxx \
19 #       -Dfile=xxx \
20 #       -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
21 #
22
23 message(STATUS "Executing ${lyx} -E ${format} ${file}.${extension} ${LYX_ROOT}/${file}.lyx")
24 set(ENV{LYX_USERDIR} "${WORKDIR}/.lyx")
25 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
26 execute_process(
27   COMMAND ${lyx} -E ${format} ${file}.${extension} "${LYX_ROOT}/${file}.lyx"
28   RESULT_VARIABLE _err)
29 string(COMPARE NOTEQUAL  ${_err} 0 _erg)
30 if(_erg)
31   message(STATUS "Exporting ${f}.lyx to ${format}")
32   message(FATAL_ERROR "Export failed")
33 endif()