File: CMakeLists.txt

package info (click to toggle)
kdepimlibs 4:4.14.10-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 35,856 kB
  • sloc: cpp: 269,391; xml: 4,188; ansic: 2,946; yacc: 1,904; perl: 381; ruby: 60; sh: 60; makefile: 13
file content (144 lines) | stat: -rw-r--r-- 3,983 bytes parent folder | download | duplicates (2)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )

include_directories(
 ${CMAKE_SOURCE_DIR}/kcal
 ${LIBICAL_INCLUDE_DIRS}
)


MACRO(KCAL_UNIT_TESTS)
  FOREACH(_testname ${ARGN})
    kde4_add_unit_test(${_testname} NOGUI ${_testname}.cpp)
    target_link_libraries(${_testname} ${KDE4_KDECORE_LIBS} kcal ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${LIBICAL_LIBRARIES})
  ENDFOREACH(_testname)
ENDMACRO(KCAL_UNIT_TESTS)

MACRO(KCAL_EXECUTABLE_TESTS)
  FOREACH(_testname ${ARGN})
    kde4_add_executable(${_testname} NOGUI TEST ${_testname}.cpp)
    target_link_libraries(${_testname} ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} kcal ${QT_QTTEST_LIBRARY})
  ENDFOREACH(_testname)
ENDMACRO(KCAL_EXECUTABLE_TESTS)

KCAL_UNIT_TESTS(
  testalarm
  testassignmentvisitor
  testattachment
  testattendee
  testcalendarlocal
  testcalendarnull
#  testcalendarresources  disable for now because it cause akonadi to start
  testcalfilter
  testcomparisonvisitor
  testcustomproperties
  testduration
  testerrorformat
  testevent
  testfilestorage
  testfreebusy
  testincidencerelation
  testjournal
  testkresult
  testperiod
  testperson
  testsortablelist
  testtodo
  testtimesininterval
)

set_target_properties(testcalendarlocal PROPERTIES COMPILE_FLAGS -DICALTESTDATADIR="\\"${CMAKE_SOURCE_DIR}/kcal/tests/data/\\"" )
# this test cannot work with msvc because libical should not be altered
# and therefore we can't add KCAL_EXPORT_DEPRECATED there
# it should work fine with mingw because of the auto-import feature
if(NOT MSVC)
  KCAL_UNIT_TESTS(testicaltimezones)
endif()

KCAL_EXECUTABLE_TESTS(
  convertqtopia
  incidencestest
  loadcalendar
  fbrecurring
  readandwrite
  testfb
  testrecurprevious
  testrecurrence
  testrecurrencetype
  testrecurson
  testtostring
  testvcalexport
)
if (NOT KDEPIM_NO_KRESOURCES)
  KCAL_EXECUTABLE_TESTS(
    testresource
  )
endif()

########### next target ###############
set(testfields_SRCS testfields.cpp)
set(srcfile "${CMAKE_SOURCE_DIR}/kcal/tests/data/test_pilot.ics")
add_definitions( -D_TESTINPUT="${srcfile}" )

kde4_add_executable(testfields TEST ${testfields_SRCS})

target_link_libraries(testfields  ${KDE4_KDECORE_LIBS} kcal )


########### Tests #######################


FILE( GLOB_RECURSE testFiles       data/RecurrenceRule/*.ics )
FILE( GLOB_RECURSE compatFiles     data/Compat/*.ics )
FILE( GLOB_RECURSE vCalFilesAsIcal data/vCalendar/*.ics )
FILE( GLOB_RECURSE vCalFiles       data/vCalendar/*.vcs )

if (WIN32)
  find_program(PERL_EXECUTABLE perl)
endif()

macro(kcal_run_single_test _prefix _file _test _testarg)
  get_filename_component( _fn ${_file} NAME)

  # Write the output file in the build directory.
  string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" _outFile ${_file})
  get_filename_component( _outputPath ${_outFile} PATH)
  file(MAKE_DIRECTORY ${_outputPath})

  set(_runner ${CMAKE_CURRENT_SOURCE_DIR}/runsingletestcase.pl)
  if (UNIX)
    set(_test_path ${EXECUTABLE_OUTPUT_PATH}/${_test}.shell)
  endif()
  if (WIN32)
    set(_test_path ${EXECUTABLE_OUTPUT_PATH}/${_test}.exe.bat)
    set(_runner ${PERL_EXECUTABLE} ${_runner})
  endif()

  add_test( ${_prefix}-${_fn} ${_runner} ${_test_path} ${_testarg} ${_file} ${_outFile})
endmacro()

FILE(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/FAILED.log)

FOREACH( file ${testFiles} )
  kcal_run_single_test( RecurNext ${file} testrecurrence "next" )
ENDFOREACH(file)

FOREACH( file ${testFiles} )
  kcal_run_single_test( RecurPrev ${file} testrecurprevious "prev" )
ENDFOREACH(file)

FOREACH( file ${testFiles} )
  kcal_run_single_test( RecursOn ${file} testrecurson "recurson" )
ENDFOREACH(file)

FOREACH( file ${compatFiles} )
  kcal_run_single_test( Compat ${file} readandwrite "ical" )
ENDFOREACH(file)

FOREACH( file ${vCalFilesAsIcal} )
  kcal_run_single_test( VCalOut ${file} testvcalexport "vcal" )
ENDFOREACH(file)

FOREACH( file ${vCalFiles} )
  kcal_run_single_test( VCalIn ${file} readandwrite "ical" )
ENDFOREACH(file)