]> git.lyx.org Git - lyx.git/blob - src/tests/CMakeLists.txt
cmake: Try to make layout-tests available for MSVC too
[lyx.git] / src / 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) 2013 Kornel Benko kornel@lyx.org
5 #
6
7 set(check_Layout_SOURCES)
8 foreach(_f insets/InsetLayout.cpp Color.cpp Counters.cpp Floating.cpp
9        FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp Lexer.cpp
10        ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_Layout.cpp
11        support/tests/boost.cpp support/tests/dummy_functions.cpp)
12   list(APPEND check_Layout_SOURCES "${TOP_SRC_DIR}/src/${_f}")
13 endforeach()
14
15 add_definitions(-DNO_LAYOUT_CSS)
16 add_executable(check_Layout ${check_Layout_SOURCES})
17
18 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
19   set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition")
20 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
21   set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} /FORCE:MULTIPLE")
22 else()
23   message(STATUS "Allow multiple definitions for cxx-compiler ${CMAKE_CXX_COMPILER_ID} not handled")
24 endif()
25
26 target_link_libraries(check_Layout support ${QT_QTMAIN_LIBRARY})
27 add_dependencies(lyx_run_tests check_Layout)
28
29 file(GLOB layout_files RELATIVE "${TOP_SRC_DIR}/lib/layouts" "${TOP_SRC_DIR}/lib/layouts/*.layout")
30 list(SORT layout_files)
31 foreach(bns ${layout_files}) 
32   string(REPLACE ".layout" "" bn ${bns})
33
34   add_test(NAME "check_Layout/${bns}"
35     COMMAND check_Layout "${TOP_SRC_DIR}/lib/layouts/${bn}")
36 endforeach()