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

4
project(mailcommon VERSION ${PIM_VERSION})
5

6
set(KF5_MIN_VERSION "5.64.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})
Laurent Montel's avatar
Laurent Montel committed
32
33
34
35
36
37
38
set(AKONADIMIME_LIB_VERSION "5.13.40")
set(MESSAGELIB_LIB_VERSION "5.13.40")
set(KMIME_LIB_VERSION "5.13.40")
set(KMAILTRANSPORT_LIB_VERSION "5.13.40")
set(MAILIMPORTER_LIB_VERSION "5.13.40")
set(LIBKDEPIM_LIB_VERSION "5.13.40")
set(PIMCOMMON_LIB_VERSION "5.13.40")
Laurent Montel's avatar
Laurent Montel committed
39

40
set(AKONADI_VERSION "5.13.41")
Laurent Montel's avatar
Laurent Montel committed
41
42
43
44
45
46
47
set(AKONADIMIME_LIB_VERSION "5.13.40")
set(MESSAGELIB_LIB_VERSION "5.13.40")
set(KMIME_LIB_VERSION "5.13.40")
set(KMAILTRANSPORT_LIB_VERSION "5.13.40")
set(MAILIMPORTER_LIB_VERSION "5.13.40")
set(LIBKDEPIM_LIB_VERSION "5.13.40")
set(PIMCOMMON_LIB_VERSION "5.13.40")
48
set(PHONON_LIB_VERSION "4.10.60")
Laurent Montel's avatar
Laurent Montel committed
49
set(AKONADI_VERSION "5.13.40")
Laurent Montel's avatar
Laurent Montel committed
50

51
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets DBus Test Xml)
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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)
68
69

find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
70
find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
71
find_package(KF5Libkdepim ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
72
find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
73
find_package(KF5MailImporter ${MAILIMPORTER_LIB_VERSION} CONFIG REQUIRED)
74
find_package(KF5MailTransport ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED)
75
76
77
78
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
79
find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED)
80
find_package(KF5TemplateParser ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
81
find_package(Phonon4Qt5 ${PHONON_LIB_VERSION} CONFIG REQUIRED)
82

83
84
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
85

86
ecm_setup_version(PROJECT VARIABLE_PREFIX MAILCOMMON
87
88
89
90
91
92
93
94
95
                        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
96
remove_definitions( -DQT_NO_CAST_FROM_ASCII )
97
add_definitions(-DQT_NO_FOREACH)
98
option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE)
99

100
101
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
102
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
103
104
endif()

105
106
107
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5MailCommon")

Laurent Montel's avatar
Laurent Montel committed
108
configure_package_config_file(
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
  "${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)
129
130
131
if(BUILD_TESTING)
    add_subdirectory(autotests)
endif()
132
install(FILES mailcommon.renamecategories mailcommon.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
Laurent Montel's avatar
Laurent Montel committed
133
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)