CMakeLists.txt 3.65 KB
Newer Older
1
cmake_minimum_required(VERSION 3.0)
Laurent Montel's avatar
Laurent Montel committed
2

3
set(PIM_VERSION "5.6.40")
4
project(Akonadi-Calendar  VERSION ${PIM_VERSION})
Laurent Montel's avatar
Laurent Montel committed
5 6

# ECM setup
7
set(KF5_VERSION "5.37.0")
Laurent Montel's avatar
Laurent Montel committed
8 9 10 11 12 13 14 15 16
option(RUN_UNINSTALL "test run uninstalled apps (experimental)" FALSE)

set(ECM_VERSION ${KF5_VERSION})
# ECM setup
if (RUN_UNINSTALL)
   set(ECM_VERSION "5.38.0")
endif()

find_package(ECM ${ECM_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
17 18 19 20 21
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
Laurent Montel's avatar
Laurent Montel committed
22
include(CMakePackageConfigHelpers)
Laurent Montel's avatar
Laurent Montel committed
23 24 25 26
include(ECMSetupVersion)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
27
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
28
include(ECMQtDeclareLoggingCategory)
Laurent Montel's avatar
Laurent Montel committed
29 30
include(ECMCoverageOption)

Laurent Montel's avatar
Laurent Montel committed
31

Laurent Montel's avatar
Laurent Montel committed
32
set(AKONADICALENDAR_LIB_VERSION ${PIM_VERSION})
33 34 35 36 37 38 39
set(CALENDARCORE_LIB_VERSION "5.6.40")
set(AKONADICONTACT_LIB_VERSION "5.6.40")
set(AKONADI_LIB_VERSION "5.6.40")
set(MAILTRANSPORT_LIB_VERSION "5.6.40")
set(KCONTACTS_LIB_VERSION "5.6.40")
set(CALENDARUTILS_LIB_VERSION "5.6.40")
set(IDENTITYMANAGEMENT_LIB_VERSION "5.6.40")
40
ecm_setup_version(PROJECT VARIABLE_PREFIX AKONADICALENDAR
Laurent Montel's avatar
Laurent Montel committed
41 42 43 44 45
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/akonadi-calendar_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiCalendarConfigVersion.cmake"
                        SOVERSION 5
)

Laurent Montel's avatar
Laurent Montel committed
46 47
configure_file(akonadi-calendar-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/akonadi-calendar-version.h @ONLY)

David Faure's avatar
David Faure committed
48 49 50 51 52
if(BUILD_TESTING)
    set(AKONADI_CALENDAR_TESTS_EXPORT AKONADI_CALENDAR_EXPORT)
endif()
configure_file(akonadi-calendar_tests_export.h.in "${CMAKE_CURRENT_BINARY_DIR}/src/akonadi-calendar_tests_export.h" @ONLY)

Laurent Montel's avatar
Laurent Montel committed
53

Laurent Montel's avatar
Laurent Montel committed
54 55
########### Find packages ###########
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
56
find_package(KF5Wallet ${KF5_VERSION} CONFIG REQUIRED)
57
find_package(KF5Codecs ${KF5_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
58

Laurent Montel's avatar
Laurent Montel committed
59
find_package(KF5MailTransportAkonadi ${MAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
60 61 62 63
find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarCore ${CALENDARCORE_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarUtils ${CALENDARUTILS_LIB_VERSION} CONFIG REQUIRED)
64

Laurent Montel's avatar
Laurent Montel committed
65 66
find_package(KF5Akonadi ${AKONADI_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiContact ${AKONADICONTACT_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
67 68 69

########### Targets ###########

70
add_definitions(-DTRANSLATION_DOMAIN=\"libakonadi-calendar5\")
71
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
72
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
73
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
74
#add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
75

Laurent Montel's avatar
Laurent Montel committed
76
add_subdirectory(src)
77 78 79 80

if (BUILD_TESTING)
    add_subdirectory(autotests)
endif ()
Laurent Montel's avatar
Laurent Montel committed
81 82

########### CMake Config Files ###########
83
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5AkonadiCalendar")
Laurent Montel's avatar
Laurent Montel committed
84

Laurent Montel's avatar
Laurent Montel committed
85
configure_package_config_file(
Laurent Montel's avatar
Laurent Montel committed
86 87 88 89 90 91 92 93 94 95 96 97
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5AkonadiCalendarConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiCalendarConfig.cmake"
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
)

install(FILES
  "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiCalendarConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiCalendarConfigVersion.cmake"
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

Laurent Montel's avatar
Laurent Montel committed
98
install(EXPORT KF5AkonadiCalendarTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5AkonadiCalendarTargets.cmake NAMESPACE KF5::)
Laurent Montel's avatar
Laurent Montel committed
99 100 101

install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/akonadi-calendar_version.h
102
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
Laurent Montel's avatar
Laurent Montel committed
103 104
)

Laurent Montel's avatar
Laurent Montel committed
105
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
Laurent Montel's avatar
Laurent Montel committed
106