]> git.lyx.org Git - features.git/blob - development/autotests/export.cmake
Cmake build tests: Unify use of userdir
[features.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_USERDIR_VER = Name of environment variable for the user directory
9 # lyx       = 
10 # format    = lyx16x|xhtml
11 # extension = 16.lyx|xhtml
12 # file      = xxx
13 #
14 # Script should be called like:
15 # cmake -DLYX_ROOT=xxx \
16 #       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
17 #       -DWORKDIR=${BUILD_DIR}/autotests/out-home \
18 #       -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
19 #       -Dlyx=xxx \
20 #       -Dformat=xxx \
21 #       -Dextension=xxx \
22 #       -Dfile=xxx \
23 #       -Dreverted=[01] \
24 #       -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
25 #
26
27 message(STATUS "Executing ${lyx} -userdir \"${WORKDIR}/.lyx\" -E ${format} ${file}.${extension} \"${LYX_ROOT}/${file}.lyx\"")
28 set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
29 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
30 execute_process(
31   COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${file}.${extension} "${LYX_ROOT}/${file}.lyx"
32   RESULT_VARIABLE _err)
33 if(reverted)
34   string(COMPARE EQUAL  ${_err} 0 _erg)
35 else()
36   string(COMPARE NOTEQUAL  ${_err} 0 _erg)
37 endif()
38 if(_erg)
39   message(STATUS "Exporting ${f}.lyx to ${format}")
40   message(FATAL_ERROR "Export failed")
41 endif()