]> git.lyx.org Git - lyx.git/blob - development/autotests/export.cmake
Cmake build: autotests
[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}
8 # lyx       = ${TOP_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/lyx
9 #
10 # Script should be called like:
11 # cmake -DLYX_ROOT=xxx \
12 #       -Dlyx=xxx \
13 #       -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
14 #
15 file(GLOB lyx_files "${LYX_ROOT}/lib/doc/*.lyx")
16 message(STATUS "lyx_files = ${lyx_files}")
17
18 set(ERRORS)
19 foreach(format lyx16x xhtml)
20   foreach(f ${lyx_files})
21     message(STATUS "Executing ${lyx} -E ${format} localtest.${format} ${f}")
22     execute_process(COMMAND ${CMAKE_COMMAND} -E remove localtest.xhtml localtest.16.lyx)
23     execute_process(
24       COMMAND ${lyx} -E ${format} localtest.${format} ${f}
25       RESULT_VARIABLE _err)
26     string(COMPARE NOTEQUAL  ${_err} 0 _erg)
27     if(_erg)
28       list(APPEND ERRORS "Exporting ${f} to ${format}")
29     endif()
30   endforeach()
31 endforeach()
32 if(ERRORS)
33   foreach(m ${ERRORS})
34     message(STATUS ${m})
35   endforeach()
36   message(FATAL_ERROR "Export failed")
37 endif()