diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 655f25f1d..ceaa6cbe5 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -1,124 +1,125 @@ include(ECMMarkAsTest) find_package(Qt5Test ${QT_REQUIRED_VERSION} CONFIG REQUIRED) # needed by loadcalendar file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cal DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) macro(macro_unit_tests) foreach(_testname ${ARGN}) add_executable(${_testname} ${_testname}.cpp) add_test(NAME ${_testname} COMMAND ${_testname}) ecm_mark_as_test(${_testname}) target_link_libraries(${_testname} KF5::ConfigCore KF5CalendarCore Qt5::Test) endforeach() endmacro() macro_unit_tests( testalarm testattachment testattendee testcalfilter testcustomproperties testduration testevent testincidence testexception testfilestorage testfreebusy testincidencerelation testicalformat testjournal testmemorycalendar testperiod testfreebusyperiod testperson testrecurtodo testsortablelist testtodo testtimesininterval testcreateddatecompat testrecurrenceexception testoccurrenceiterator testreadrecurrenceid incidencestest loadcalendar fbrecurring readandwrite testfb testrecurprevious testrecurrence testrecurrencetype testrecurson testtostring testvcalexport testcalendarobserver ) set_target_properties(testmemorycalendar PROPERTIES COMPILE_FLAGS -DICALTESTDATADIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/data/\\"") set_target_properties(testreadrecurrenceid PROPERTIES COMPILE_FLAGS -DICALTESTDATADIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/data/\\"") # this test cannot work with msvc because libical should not be altered # and therefore we can't add KCALCORE_EXPORT there # it should work fine with mingw because of the auto-import feature # TODO: check if this can build with msvc now (and if it works on Windows) if(NOT MSVC) macro_unit_tests(testicaltimezones) + target_link_libraries(testicaltimezones ${LibIcal_LIBRARIES}) endif() ########### 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(kcalcore_run_single_test _prefix _f _test _testarg) get_filename_component(_fn ${_f} NAME) # Write the output file in the build directory. string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" _outFile ${_f}) get_filename_component(_outputPath ${_outFile} PATH) file(MAKE_DIRECTORY ${_outputPath}) set(_runner ${CMAKE_CURRENT_SOURCE_DIR}/runsingletestcase.pl) get_property(_output_dir TARGET ${_test} PROPERTY RUNTIME_OUTPUT_DIRECTORY) if(NOT _output_dir) set(_output_dir ${CMAKE_CURRENT_BINARY_DIR}) endif() set(_test_path ${_output_dir}/${_test}) if(WIN32) set(_runner ${PERL_EXECUTABLE} ${_runner}) endif() add_test(${_prefix}-${_fn} ${_runner} ${_test_path} ${_testarg} ${_f} ${_outFile}) endmacro() file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/FAILED.log) foreach(file ${testFiles}) kcalcore_run_single_test(RecurNext ${file} testrecurrence "next") endforeach() foreach(file ${testFiles}) kcalcore_run_single_test(RecurPrev ${file} testrecurprevious "prev") endforeach() foreach(file ${testFiles}) kcalcore_run_single_test(RecursOn ${file} testrecurson "recurson") endforeach() foreach(file ${compatFiles}) kcalcore_run_single_test(Compat ${file} readandwrite "ical") endforeach() foreach(file ${vCalFilesAsIcal}) kcalcore_run_single_test(VCalOut ${file} testvcalexport "vcal") endforeach() foreach(file ${vCalFiles}) kcalcore_run_single_test(VCalIn ${file} readandwrite "ical") endforeach() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 659a0a2f1..3feef3d11 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,145 +1,146 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-kcalcore.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kcalcore.h ) ########### next target ############### bison_target(VersitParser ${CMAKE_CURRENT_SOURCE_DIR}/versit/vcc.y ${CMAKE_CURRENT_BINARY_DIR}/vcc-parser.c ) set(libversit_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/versit/vobject.c ${BISON_VersitParser_OUTPUTS} ) set(kcalcore_LIB_SRCS ${libversit_SRCS} alarm.cpp attachment.cpp attendee.cpp calendar.cpp calfilter.cpp calformat.cpp calstorage.cpp compat.cpp customproperties.cpp duration.cpp event.cpp exceptions.cpp filestorage.cpp freebusy.cpp freebusycache.cpp freebusyperiod.cpp icalformat.cpp icalformat_p.cpp icaltimezones.cpp incidence.cpp incidencebase.cpp journal.cpp memorycalendar.cpp occurrenceiterator.cpp period.cpp person.cpp recurrence.cpp recurrencerule.cpp schedulemessage.cpp sorting.cpp todo.cpp utils.cpp vcalformat.cpp visitor.cpp ) ecm_qt_declare_logging_category(kcalcore_LIB_SRCS HEADER kcalcore_debug.h IDENTIFIER KCALCORE_LOG CATEGORY_NAME org.kde.pim.kcalcore) add_library(KF5CalendarCore ${kcalcore_LIB_SRCS}) generate_export_header(KF5CalendarCore BASE_NAME kcalcore) add_library(KF5::CalendarCore ALIAS KF5CalendarCore) target_include_directories(KF5CalendarCore INTERFACE "$") target_include_directories(KF5CalendarCore PUBLIC "$") target_include_directories(KF5CalendarCore PUBLIC "$") target_link_libraries(KF5CalendarCore PUBLIC KF5::KDELibs4Support +PRIVATE ${LibIcal_LIBRARIES} ) if(HAVE_UUID_LIBRARY) target_link_libraries(KF5CalendarCore PRIVATE ${UUID_LIBRARY} ) endif() set_target_properties(KF5CalendarCore PROPERTIES VERSION ${KCALCORE_VERSION_STRING} SOVERSION ${KCALCORE_SOVERSION} EXPORT_NAME CalendarCore ) install(TARGETS KF5CalendarCore EXPORT KF5CalendarCoreTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) ########### Generate Headers ############### ecm_generate_headers(KCalCore_CamelCase_HEADERS HEADER_NAMES Alarm Attachment Attendee CalFilter CalFormat CalStorage Calendar CustomProperties Duration Event Exceptions # NOTE: Used to be called 'Exception' in KDE4 FileStorage FreeBusy FreeBusyCache FreeBusyPeriod ICalFormat Incidence IncidenceBase Journal MemoryCalendar OccurrenceIterator Period Person Recurrence RecurrenceRule ScheduleMessage SortableList Sorting Todo Utils VCalFormat Visitor PREFIX KCalCore REQUIRED_HEADERS KCalCore_HEADERS ) ########### install files ############### install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kcalcore_export.h ${KCalCore_HEADERS} supertrait.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KCalCore/kcalcore COMPONENT Devel ) install(FILES ${KCalCore_CamelCase_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KCalCore/KCalCore COMPONENT Devel ) ecm_generate_pri_file(BASE_NAME KCalCore LIB_NAME KF5CalendarCore DEPS "ItemViews KDELibs4Support" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KCalCore/KCalCore) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})