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