]> git.lyx.org Git - lyx.git/blob - src/support/tests/CMakeLists.txt
Add a special regfile for filetools test on windows
[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 ${intl_link}
17                 ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
18                 ${ZLIB_LIBRARY} ${ICONV_LIBRARY})
19 endmacro()
20
21 file(GLOB test_sources ${TOP_SRC_DIR}/src/support/tests/${LYX_CPP_FILES})
22
23 include_directories(
24         ${TOP_SRC_DIR}/src/support/tests
25         ${QT_INCLUDES}
26         ${ICONV_INCLUDE_DIR}
27         ${ZLIB_INCLUDE_DIR}
28         ${LIBINTL_INCLUDE_DIR})
29
30
31 set(check_PROGRAMS check_convert check_filetools check_lstrings)
32
33 file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/regfiles")
34
35 set(_depends)
36 foreach(_src ${check_PROGRAMS})
37         sources(${_src} ${_src}.cpp dummy_functions.cpp boost.cpp)
38         string(REPLACE "check_" "" _srcx ${_src})
39         set(src_data_file "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}")
40         if (MSVC AND EXISTS "${src_data_file}.MSVC")
41                 set(src_data_file "${src_data_file}.MSVC")
42         endif()
43         set(created_data_file "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}_data")
44         add_test(NAME support/${_srcx}
45           COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:${_src}>
46                                    -DInput=${src_data_file}
47                                    -DOutput=${created_data_file}
48                                    -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
49
50         set_target_properties(${_src} PROPERTIES FOLDER "tests/support")
51         add_dependencies(lyx_run_tests ${_src})
52 endforeach()
53
54