]> git.lyx.org Git - lyx.git/blob - src/support/tests/CMakeLists.txt
Added check for support tests in cmake build.
[lyx.git] / src / support / tests / CMakeLists.txt
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 project(supporttest)
8
9 macro(sources _program)
10         set(_tmplist)
11         foreach(_tmp ${ARGN})
12                 list(APPEND _tmplist "${TOP_SRC_DIR}/src/support/tests/${_tmp}")
13         endforeach()
14         set(${_program}_SOURCES ${_tmplist})
15         add_executable(${_program} ${_tmplist})
16         target_link_libraries(${_program} support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY})
17 endmacro()
18
19 file(GLOB test_sources ${TOP_SRC_DIR}/src/support/tests/${LYX_CPP_FILES})
20
21 include_directories(
22         ${TOP_SRC_DIR}/src/support/tests
23         ${QT_INCLUDES}
24         ${ICONV_INCLUDE_DIR}
25         ${ZLIB_INCLUDE_DIR}
26         ${LIBINTL_INCLUDE_DIR})
27
28
29 set(check_PROGRAMS check_convert check_filetools check_lstrings)
30
31 set(_depends)
32 foreach(_src ${check_PROGRAMS})
33         sources(${_src} ${_src}.cpp dummy_functions.cpp boost.cpp)
34         #message(STATUS "${_src}_SOURCES = " ${${_src}_SOURCES})
35         string(REPLACE "check_" "" _srcx ${_src})
36         add_custom_command(
37                 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}
38                 COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/regfiles"
39                 COMMAND "${CMAKE_BINARY_DIR}/bin/${_src}" > ${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}
40                 COMMAND ${CMAKE_COMMAND} -E compare_files "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}" "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}"
41                 DEPENDS "${CMAKE_BINARY_DIR}/bin/${_src}" "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}"
42                 COMMENT "'${CMAKE_BINARY_DIR}/bin/${_src}' > '${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}'"
43         )
44         list(APPEND _depends "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}")
45 endforeach()
46
47 add_custom_target(checkregfiles DEPENDS support ${_depends})
48