From de48b4a218391da82d8bb725e5b8cb3038155065 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Sun, 18 Dec 2016 16:44:15 +0300 Subject: [PATCH] fixup! tdecore/tdeconfig_compiler: add check/test executables Signed-off-by: Alexander Golubev (cherry picked from commit d556a8752c0862aa2d84a105dc8ac41b61ba7824) --- .../tdeconfig_compiler/tests/CMakeLists.txt | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 tdecore/tdeconfig_compiler/tests/CMakeLists.txt diff --git a/tdecore/tdeconfig_compiler/tests/CMakeLists.txt b/tdecore/tdeconfig_compiler/tests/CMakeLists.txt new file mode 100644 index 000000000..3034773b0 --- /dev/null +++ b/tdecore/tdeconfig_compiler/tests/CMakeLists.txt @@ -0,0 +1,82 @@ +################################################# +# +# (C) 2016 Alexander Golubev +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${TQT_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/dcop + ${CMAKE_BINARY_DIR}/tdecore + ${CMAKE_SOURCE_DIR}/tdecore +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +add_definitions( + -DQT_NO_CAST_ASCII + -DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" +) + +set( TESTS test1 test2 test3 test4 test5 test6 test7 test8 test9 test_dpointer ) + +# A couple of test got specific settings +set( test8_KCFG test8a test8b ) +set( test_dpointer_MAIN test_dpointer_main.cpp ) + +foreach( tst ${TESTS} ) + unset( _sources ) + + # add main file (the second one is default + if( ${tst}_MAIN ) + list( APPEND _sources ${${tst}_MAIN} ) + else() + list( APPEND _sources "${tst}main.cpp" ) + endif() + + # set the default kcfg name + if( NOT ${tst}_KCFG ) + set( ${tst}_KCFG ${tst} ) + endif() + + # kcfgc's here are not designed to be passed to kde3_add_kcfg_files() macro + # so we will process them manually + foreach( kcfg ${${tst}_KCFG}) + add_custom_command( + OUTPUT ${kcfg}.cpp ${kcfg}.h + COMMAND "${CMAKE_BINARY_DIR}/tdecore/tdeconfig_compiler/tdeconfig_compiler" + ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${kcfg}.kcfg" + "${CMAKE_CURRENT_SOURCE_DIR}/${kcfg}.kcfgc" + DEPENDS tdeconfig_compiler "${CMAKE_CURRENT_SOURCE_DIR}/${kcfg}.kcfg" + "${CMAKE_CURRENT_SOURCE_DIR}/${kcfg}.kcfgc" + ) + + add_test( NAME tdecore/tdeconfig_compiler/${kcfg}-cpp + COMMAND ${CMAKE_COMMAND} -E compare_files + "${CMAKE_CURRENT_BINARY_DIR}/${kcfg}.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/${kcfg}.cpp.ref" ) + + add_test( NAME tdecore/tdeconfig_compiler/${kcfg}-header + COMMAND ${CMAKE_COMMAND} -E compare_files + "${CMAKE_CURRENT_BINARY_DIR}/${kcfg}.h" + "${CMAKE_CURRENT_SOURCE_DIR}/${kcfg}.h.ref" ) + + list( APPEND _sources ${CMAKE_CURRENT_BINARY_DIR}/${kcfg}.cpp ) + endforeach( ) + + tde_add_check_executable( ${tst} AUTOMOC + SOURCES ${_sources} + LINK tdecore-shared + ) +endforeach( tst ${TESTS} )