]> git.lyx.org Git - features.git/commitdiff
Added check for support tests in cmake build.
authorKornel Benko <kornel@lyx.org>
Fri, 5 Oct 2012 14:56:29 +0000 (16:56 +0200)
committerKornel Benko <kornel@lyx.org>
Fri, 5 Oct 2012 14:56:29 +0000 (16:56 +0200)
New target: checkregfiles
This will create the regfiles and compare with the data in source.

src/support/CMakeLists.txt
src/support/tests/CMakeLists.txt [new file with mode: 0644]

index 521a42a255d558a41e0c5f446c9ad06fef728090..5aa083dfc9ab91bb7077e7973abf2b5209584fb2 100644 (file)
@@ -38,6 +38,8 @@ else()
        set(support_linkback_headers "")
 endif()
 
+add_subdirectory(tests)
+
 # needed to compile tex2lyx in merged mode
 set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/support/gettext.cpp)
 
diff --git a/src/support/tests/CMakeLists.txt b/src/support/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2189245
--- /dev/null
@@ -0,0 +1,48 @@
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# Copyright (c) 2012 Kornel Benko, kornel@lyx.org
+#
+
+project(supporttest)
+
+macro(sources _program)
+       set(_tmplist)
+       foreach(_tmp ${ARGN})
+               list(APPEND _tmplist "${TOP_SRC_DIR}/src/support/tests/${_tmp}")
+       endforeach()
+       set(${_program}_SOURCES ${_tmplist})
+       add_executable(${_program} ${_tmplist})
+       target_link_libraries(${_program} support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY})
+endmacro()
+
+file(GLOB test_sources ${TOP_SRC_DIR}/src/support/tests/${LYX_CPP_FILES})
+
+include_directories(
+       ${TOP_SRC_DIR}/src/support/tests
+       ${QT_INCLUDES}
+       ${ICONV_INCLUDE_DIR}
+       ${ZLIB_INCLUDE_DIR}
+       ${LIBINTL_INCLUDE_DIR})
+
+
+set(check_PROGRAMS check_convert check_filetools check_lstrings)
+
+set(_depends)
+foreach(_src ${check_PROGRAMS})
+       sources(${_src} ${_src}.cpp dummy_functions.cpp boost.cpp)
+       #message(STATUS "${_src}_SOURCES = " ${${_src}_SOURCES})
+       string(REPLACE "check_" "" _srcx ${_src})
+       add_custom_command(
+               OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}
+               COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/regfiles"
+               COMMAND "${CMAKE_BINARY_DIR}/bin/${_src}" > ${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}
+               COMMAND ${CMAKE_COMMAND} -E compare_files "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}" "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}"
+               DEPENDS "${CMAKE_BINARY_DIR}/bin/${_src}" "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}"
+               COMMENT "'${CMAKE_BINARY_DIR}/bin/${_src}' > '${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}'"
+       )
+       list(APPEND _depends "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}")
+endforeach()
+
+add_custom_target(checkregfiles DEPENDS support ${_depends})
+