]> git.lyx.org Git - lyx.git/blobdiff - src/tests/CMakeLists.txt
Account for old versions of Pygments
[lyx.git] / src / tests / CMakeLists.txt
index d82c4ff79b2f38afdcd942b63c1fee4fc3845b46..8b0c6d5180669d2ae32ea2f18b87d43c103a35bc 100644 (file)
 #
 
 set(check_layout_SOURCES)
-foreach(_f insets/InsetLayout.cpp Color.cpp Counters.cpp Floating.cpp
+foreach(_f insets/InsetLayout.cpp CiteEnginesList.cpp Color.cpp Counters.cpp Floating.cpp
        FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp Lexer.cpp
        ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_layout.cpp
-       support/tests/boost.cpp support/tests/dummy_functions.cpp)
+       tests/boost.cpp support/tests/dummy_functions.cpp)
   list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}")
 endforeach()
 
-add_definitions(-DNO_LAYOUT_CSS)
+include_directories(${TOP_SRC_DIR}/src/support/tests)
+
 add_executable(check_layout ${check_layout_SOURCES})
 
-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-  set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition")
-elseif(MSVC)
-  set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} /FORCE:MULTIPLE")
-else()
-         message(STATUS "Allow multiple definitions for cxx-compiler ${CMAKE_CXX_COMPILER_ID} not handled")
-       endif()
-
-       target_link_libraries(check_layout support ${intl_link}
-                       ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY}
-               ${ZLIB_LIBRARY} ${ICONV_LIBRARY})
+target_link_libraries(check_layout support
+  ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
+  ${ZLIB_LIBRARY} ${ICONV_LIBRARY})
+if(CYGWIN)
+    target_link_libraries(check_layout shlwapi)
+endif()
+lyx_target_link_libraries(check_layout Magic)
+
 add_dependencies(lyx_run_tests check_layout)
 set_target_properties(check_layout PROPERTIES FOLDER "tests/src")
 
 file(GLOB layout_files RELATIVE "${TOP_SRC_DIR}/lib/layouts" "${TOP_SRC_DIR}/lib/layouts/*.layout")
+file(GLOB module_files RELATIVE "${TOP_SRC_DIR}/lib/layouts" "${TOP_SRC_DIR}/lib/layouts/*.module")
 list(SORT layout_files)
-foreach(bns ${layout_files}) 
-  string(REPLACE ".layout" "" bn ${bns})
+list(SORT module_files)
+
+foreach(bns ${layout_files} ${module_files})
+  string(REGEX REPLACE "\\.(layout|module)" "" bn ${bns})
+  set(_checktype ${CMAKE_MATCH_1})
+  if("${_checktype}" STREQUAL "module")
+    file(WRITE "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "#% Do not delete the line below; configure depends on this\n")
+    file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "#  \\DeclareLaTeXClass{test${bn}}\n")
+    file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Format 63\n")
+    file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Style Standard\n")
+    file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " LabelType No_Label\n")
+    file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " Category MainText\n")
+    file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "End\n")
+    file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Input ${bns}\n")
+    add_test(NAME "check_layout/${bns}"
+      COMMAND ${CMAKE_COMMAND}
+       "-DCheckLayout=$<TARGET_FILE:check_layout>"
+       "-DModule=${LYX_TESTS_USERDIR}/layouts/test${bn}"
+       "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}"
+       -P "${TOP_SRC_DIR}/src/tests/check_layout.cmake")
+    set_tests_properties("check_layout/${bns}" PROPERTIES ENVIRONMENT ${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR})
+  else()
+    add_test(NAME "check_layout/${bns}"
+      COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
+  endif()
+  settestlabel("check_layout/${bns}" "${_checktype}")
+endforeach()
+
+set(check_ExternalTransforms_SOURCES)
+foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
+       Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp
+       tests/boost.cpp support/tests/dummy_functions.cpp)
+    list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
+endforeach()
+
+include_directories(${TOP_SRC_DIR}/src/tests)
+add_executable(check_ExternalTransforms ${check_ExternalTransforms_SOURCES})
+
+target_link_libraries(check_ExternalTransforms support
+       ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
+lyx_target_link_libraries(check_ExternalTransforms Magic)
+
+add_dependencies(lyx_run_tests check_ExternalTransforms)
+set_target_properties(check_ExternalTransforms PROPERTIES FOLDER "tests/src")
+target_link_libraries(check_ExternalTransforms ${ICONV_LIBRARY})
+
+add_test(NAME "check_ExternalTransforms"
+  COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ExternalTransforms>
+       "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ExternalTransforms"
+       "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ExternalTransforms_data"
+       -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
+add_dependencies(lyx_run_tests check_ExternalTransforms)
 
-  add_test(NAME "check_layout/${bns}"
-    COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}")
+set(check_Length_SOURCES)
+foreach(_f Length.cpp lengthcommon.cpp tests/check_Length.cpp tests/boost.cpp support/tests/dummy_functions.cpp)
+  list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f})
 endforeach()
+add_executable(check_Length ${check_Length_SOURCES})
+
+target_link_libraries(check_Length support
+       ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
+lyx_target_link_libraries(check_Length Magic)
+
+add_dependencies(lyx_run_tests check_Length)
+set_target_properties(check_Length PROPERTIES FOLDER "tests/src")
+target_link_libraries(check_Length ${ICONV_LIBRARY})
+
+add_test(NAME "check_Length"
+  COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_Length>
+       "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/Length"
+       "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/Length_data"
+       -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
+add_dependencies(lyx_run_tests check_Length)
+
+include_directories(${TOP_SRC_DIR}/src/tests)
+set(check_ListingsCaption_SOURCES)
+foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp support/tests/dummy_functions.cpp)
+  list(APPEND check_ListingsCaption_SOURCES ${TOP_SRC_DIR}/src/${_f})
+endforeach()
+add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES})
+
+target_link_libraries(check_ListingsCaption support
+       ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
+lyx_target_link_libraries(check_ListingsCaption Magic)
+
+add_dependencies(lyx_run_tests check_ListingsCaption)
+set_target_properties(check_ListingsCaption PROPERTIES FOLDER "tests/src")
+target_link_libraries(check_ListingsCaption ${ICONV_LIBRARY})
+
+add_test(NAME "check_ListingsCaption"
+  COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ListingsCaption>
+       "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ListingsCaption"
+       "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ListingsCaption_data"
+       -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
+add_dependencies(lyx_run_tests check_ListingsCaption)
+