# Commented because it uses your real calendar. You can loose data.
# I'll uncomment this when tests use testrunner.
# add_subdirectory(next/tests)

include_directories(
  ${Boost_INCLUDE_DIR}
  ${CMAKE_BINARY_DIR}/calendarviews
)
add_definitions(-DQT_NO_CAST_FROM_ASCII)
add_definitions(-DQT_NO_CAST_TO_ASCII)


add_definitions(-DTRANSLATION_DOMAIN=\"calendarsupport\")

########### next target ###############

set(calendarsupport_LIB_SRCS
  calendarsupport_debug.cpp
  archivedialog.cpp
  attachmenthandler.cpp
  calendarsingleton.cpp
  calendarutils.cpp
  categoryconfig.cpp
  categoryhierarchyreader.cpp
  cellitem.cpp
  collectionselection.cpp
  eventarchiver.cpp
  identitymanager.cpp
  incidenceattachmentmodel.cpp
  kcalmodel.cpp
  kcalprefs.cpp
  messagewidget.cpp
  utils.cpp
  tagcache.cpp

  printing/calprintpluginbase.cpp
  printing/calprintdefaultplugins.cpp
  printing/calprinter.cpp
  printing/journalprint.cpp
  printing/yearprint.cpp

  next/incidenceviewer.cpp
)

ki18n_wrap_ui(calendarsupport_LIB_SRCS
  printing/calprintdayconfig_base.ui
  printing/calprintincidenceconfig_base.ui
  printing/calprintjournalconfig_base.ui
  printing/calprintmonthconfig_base.ui
  printing/calprinttodoconfig_base.ui
  printing/calprintweekconfig_base.ui
  printing/calprintyearconfig_base.ui
)

kconfig_add_kcfg_files(calendarsupport_LIB_SRCS kcalprefs_base.kcfgc)

# qt5_add_dbus_interface(calendarsupport_LIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/org.freedesktop.Akonadi.CalendarSearchAgent.xml calendarsearchinterface)

add_library(calendarsupport ${calendarsupport_LIB_SRCS})
generate_export_header(calendarsupport BASE_NAME calendarsupport)

target_link_libraries(
  calendarsupport
PUBLIC
  KF5::Mime
  KF5::IdentityManagement
  KF5::AkonadiCalendar
PRIVATE
  KF5::AkonadiWidgets
  KF5::Holidays
  KF5::Codecs
  KF5::AkonadiCore
  KF5::CalendarCore
  KF5::CalendarUtils
  kdepimdbusinterfaces
)

set_target_properties(calendarsupport
  PROPERTIES VERSION ${KDEPIM_LIB_VERSION}
  SOVERSION ${KDEPIM_LIB_SOVERSION}
)

install(TARGETS calendarsupport ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})

set(calendarsupportcollectionpage_LIB_SRCS
    collectiongeneralpage.cpp
)

add_library(calendarsupportcollectionpage ${calendarsupportcollectionpage_LIB_SRCS})
generate_export_header(calendarsupportcollectionpage BASE_NAME calendarsupportcollectionpage)
target_link_libraries(
  calendarsupportcollectionpage
PUBLIC
  KF5::AkonadiCore
  mailcommon
PRIVATE
  KF5::CalendarCore
  pimcommon
  KF5::AkonadiCalendar
)

set_target_properties(calendarsupportcollectionpage
  PROPERTIES VERSION ${KDEPIM_LIB_VERSION}
  SOVERSION ${KDEPIM_LIB_VERSION}
)

install(TARGETS calendarsupportcollectionpage ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})


install(FILES calendarplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR})
