summaryrefslogtreecommitdiffstats
path: root/tdecore/tdeconfig_compiler/tests/CMakeLists.txt
blob: 3034773b0bb836f3c688149b6afc837115f727f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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} )