CMakeLists.txt 4.84 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
Laurent Montel's avatar
Laurent Montel committed
2
set(PIM_VERSION "5.14.41")
3

4
project(mailcommon VERSION ${PIM_VERSION})
5

Laurent Montel's avatar
Laurent Montel committed
6
set(KF5_MIN_VERSION "5.69.0")
Laurent Montel's avatar
Laurent Montel committed
7

8
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
9
set(CMAKE_MODULE_PATH ${mailcommon_SOURCE_DIR}/cmake/modules/ ${ECM_MODULE_PATH})
Laurent Montel's avatar
Laurent Montel committed
10 11 12
if (POLICY CMP0053)
    cmake_policy(SET CMP0053 NEW)
endif()
13
set(LIBRARY_NAMELINK)
14 15 16 17 18

include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)

19 20 21
include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
22

23 24 25 26
include(ECMSetupVersion)
include(FeatureSummary)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
27

Laurent Montel's avatar
Laurent Montel committed
28

29
set(QT_REQUIRED_VERSION "5.12.0")
Laurent Montel's avatar
Minor  
Laurent Montel committed
30

Laurent Montel's avatar
Laurent Montel committed
31
set(MAILCOMMON_LIB_VERSION ${PIM_VERSION})
32
set(AKONADIMIME_LIB_VERSION "5.14.43")
Laurent Montel's avatar
Laurent Montel committed
33
set(MESSAGELIB_LIB_VERSION "5.14.42")
34 35 36 37 38
set(KMIME_LIB_VERSION "5.14.40")
set(KMAILTRANSPORT_LIB_VERSION "5.14.40")
set(MAILIMPORTER_LIB_VERSION "5.14.40")
set(LIBKDEPIM_LIB_VERSION "5.14.40")
set(PIMCOMMON_LIB_VERSION "5.14.40")
39

40
set(PHONON_LIB_VERSION "4.10.60")
41
set(AKONADI_VERSION "5.14.40")
Laurent Montel's avatar
Laurent Montel committed
42

43
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets DBus Test Xml)
44

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
find_package(KF5Archive ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Codecs ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5ItemModels ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5ItemViews ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5SyntaxHighlighting ${KF5_MIN_VERSION} CONFIG REQUIRED)
60 61

find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
62
find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
63
find_package(KF5Libkdepim ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
64
find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
65
find_package(KF5MailImporter ${MAILIMPORTER_LIB_VERSION} CONFIG REQUIRED)
66
find_package(KF5MailTransport ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED)
67 68 69 70
find_package(KF5MessageComposer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MessageCore ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MessageViewer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
71
find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED)
72
find_package(KF5TemplateParser ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
73
find_package(Phonon4Qt5 ${PHONON_LIB_VERSION} CONFIG REQUIRED)
74

75 76
option(BUILD_DESIGNERPLUGIN "Build plugin for Qt Designer" ON)
add_feature_info(DESIGNERPLUGIN ${BUILD_DESIGNERPLUGIN} "Build plugin for Qt Designer")
Laurent Montel's avatar
Laurent Montel committed
77

78
ecm_setup_version(PROJECT VARIABLE_PREFIX MAILCOMMON
79 80 81 82 83 84 85 86 87
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/mailcommon_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5MailCommonConfigVersion.cmake"
                        SOVERSION 5
)

find_package(Xsltproc)
set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces for all Akonadi resources.")

########### Targets ###########
Laurent Montel's avatar
Laurent Montel committed
88
remove_definitions( -DQT_NO_CAST_FROM_ASCII )
89
add_definitions(-DQT_NO_FOREACH)
90
add_definitions(-DQT_NO_KEYWORDS)
91
option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE)
92

93
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
94
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
95
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054500)
96 97
endif()

98 99 100
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5MailCommon")

Laurent Montel's avatar
Laurent Montel committed
101
configure_package_config_file(
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5MailCommonConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5MailCommonConfig.cmake"
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
)

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

install(EXPORT KF5MailCommonTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5MailCommonTargets.cmake NAMESPACE KF5::)

install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/mailcommon_version.h
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
)

add_subdirectory(src)
122 123 124
if(BUILD_TESTING)
    add_subdirectory(autotests)
endif()
Laurent Montel's avatar
Laurent Montel committed
125
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)