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

4
project(kmail VERSION ${PIM_VERSION})
5
6
7
8
9
10
11

include(CheckIncludeFiles)


if (POLICY CMP0063)
    cmake_policy(SET CMP0063 NEW)
endif()
12
set(KF5_MIN_VERSION "5.80.0")
13
14
15
16
17
18
19
20
21
22
23
24

find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMAddTests)

include(GenerateExportHeader)
include(ECMGenerateHeaders)

include(FeatureSummary)
25
include(KDEGitCommitHooks)
26
27
28
29
30
31
32
33
34
35
include(CheckFunctionExists)
include(ECMGeneratePriFile)

include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory)

# Do NOT add quote
36
37
set(KDEPIM_DEV_VERSION alpha)
set(RELEASE_SERVICE_VERSION "21.07.40")
38
39
40
41
42
43

# add an extra space
if(DEFINED KDEPIM_DEV_VERSION)
    set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
endif()

44
set(KDEPIM_VERSION "${PIM_VERSION}${KDEPIM_DEV_VERSION} (${RELEASE_SERVICE_VERSION})")
45
46


47
48
49
50
51
52
53
54
55
56
57
58
set(AKONADI_MIMELIB_VERSION "5.17.40")
set(AKONADI_CONTACT_VERSION "5.17.40")
set(CALENDARUTILS_LIB_VERSION "5.17.40")
set(IDENTITYMANAGEMENT_LIB_VERSION "5.17.40")
set(KLDAP_LIB_VERSION "5.17.40")
set(KMAILTRANSPORT_LIB_VERSION "5.17.40")
set(KONTACTINTERFACE_LIB_VERSION "5.17.40")
set(KMIME_LIB_VERSION "5.17.40")
set(KPIMTEXTEDIT_LIB_VERSION "5.17.40")
set(AKONADI_VERSION "5.17.40")
set(KTNEF_LIB_VERSION "5.17.40")
set(GRANTLEETHEME_LIB_VERSION "5.17.40")
59

60
set(KDEPIM_LIB_VERSION "${PIM_VERSION}")
Laurent Montel's avatar
Laurent Montel committed
61
62
set(KDEPIM_LIB_SOVERSION "5")

63
set(QT_REQUIRED_VERSION "5.14.0")
Laurent Montel's avatar
Laurent Montel committed
64
option(KDEPIM_ENTERPRISE_BUILD "Enable features specific to the enterprise branch, which are normally disabled. Also, it disables many components not needed for Kontact such as the Kolab client." FALSE)
65

66
67
option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE)

Laurent Montel's avatar
Laurent Montel committed
68
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED DBus Network Test Widgets WebEngine WebEngineWidgets)
69
70
71
72
73
74
75
76
set(LIBGRAVATAR_VERSION "5.17.40")
set(MAILCOMMON_LIB_VERSION "5.17.40")
set(MESSAGELIB_LIB_VERSION "5.17.40")
set(LIBKLEO_LIB_VERSION "5.17.40")
set(PIMCOMMON_LIB_VERSION "5.17.40")
set(LIBKDEPIM_LIB_VERSION "5.17.40")
set(LIBKSIEVE_LIB_VERSION "5.17.40")
set(AKONADI_SEARCH_VERSION "5.17.40")
Laurent Montel's avatar
Laurent Montel committed
77

Laurent Montel's avatar
Laurent Montel committed
78
find_package(KF5WebEngineViewer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
79

Laurent Montel's avatar
Laurent Montel committed
80
find_package(KF5AkonadiSearch ${AKONADI_SEARCH_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
81
set_package_properties(KF5AkonadiSearch PROPERTIES DESCRIPTION "The Akonadi Search libraries" URL "https://www.kde.org" TYPE REQUIRED PURPOSE "Provides search capabilities in KMail and Akonadi")
Laurent Montel's avatar
Laurent Montel committed
82

83
set(GPGMEPP_LIB_VERSION "1.13.1")
84
85
find_package(Gpgmepp ${GPGMEPP_LIB_VERSION} CONFIG REQUIRED)

Laurent Montel's avatar
Laurent Montel committed
86
# Find KF5 package
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
find_package(KF5Bookmarks ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Crash ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5DocTools ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5GuiAddons ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5ItemViews ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5JobWidgets ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5KCMUtils ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Notifications ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5NotifyConfig ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Parts ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Service ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Sonnet ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5WindowSystem ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
109
110
find_package(KF5Contacts ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarCore ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
111
112
113
114
115
116
117

find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiContact ${AKONADI_CONTACT_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiMime ${AKONADI_MIMELIB_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarUtils ${CALENDARUTILS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Ldap ${KLDAP_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
118
find_package(KF5MailTransportAkonadi ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
119
find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED)
120
find_package(KF5GrantleeTheme ${GRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
121
122
123
124

find_package(KF5KontactInterface ${KONTACTINTERFACE_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)

Laurent Montel's avatar
Laurent Montel committed
125
126
127
128
129
130
131
132
133
134
135
find_package(KF5Gravatar ${LIBGRAVATAR_VERSION} CONFIG REQUIRED)
find_package(KF5Libkdepim ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5LibKSieve ${LIBKSIEVE_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MailCommon ${MAILCOMMON_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MessageCore ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MessageComposer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MessageList ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MessageViewer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5TemplateParser ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
136
find_package(KF5Tnef ${KTNEF_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
137
138
find_package(MailTransportDBusService CONFIG REQUIRED)

139
140
141
142
find_package(Qt5Keychain CONFIG)
set_package_properties(Qt5Keychain PROPERTIES
                                   DESCRIPTION "Provides support for secure credentials storage"
                                   URL "https://github.com/frankosterfeld/qtkeychain"
143
				   TYPE REQUIRED)
144
145


Laurent Montel's avatar
Laurent Montel committed
146
configure_file(config-enterprise.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-enterprise.h )
Laurent Montel's avatar
Laurent Montel committed
147

148
149
include_directories(${kmail_SOURCE_DIR} ${kmail_BINARY_DIR})
configure_file(kmail-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kmail-version.h @ONLY)
150
151
152
if(BUILD_TESTING)
   add_definitions(-DBUILD_TESTING)
endif()
153

154
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
155
#add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055100) #Need to find a convert method for KPluginInfo::fromServices
Laurent Montel's avatar
Laurent Montel committed
156
set(CMAKE_CXX_STANDARD 14)
157
158
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Laurent Montel's avatar
Laurent Montel committed
159
find_package(KUserFeedback 1.0.0 CONFIG)
Laurent Montel's avatar
Laurent Montel committed
160
set_package_properties(KUserFeedback PROPERTIES DESCRIPTION "User Feedback lib" TYPE OPTIONAL PURPOSE "Allow to send Telemetry Information (optional). It can be disable in apps.")
161

Laurent Montel's avatar
Laurent Montel committed
162
163
164
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" FALSE)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT false)
if (USE_UNITY_CMAKE_SUPPORT)
165
166
167
    if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
        message(STATUS "CMAKE version is less than 3.16.0 . We can't use cmake unify build support")
    else()
Laurent Montel's avatar
Laurent Montel committed
168
        set(COMPILE_WITH_UNITY_CMAKE_SUPPORT true)
169
170
171
    endif()
endif()

Laurent Montel's avatar
Laurent Montel committed
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
option(USE_PRECOMPILED_HEADERS "Use precompiled headers" OFF) # Set to OFF when using clazy and such
set(COMPILE_WITH_CMAKE_PCH_SUPPORT false)
macro(pim_target_precompile_headers)
    if (USE_PRECOMPILED_HEADERS)
        if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
            message(STATUS "CMAKE version is less than 3.16.0 . We can't use cmake pch build support")
        else()
            set(COMPILE_WITH_CMAKE_PCH_SUPPORT true)
        endif()

        if (COMPILE_WITH_CMAKE_PCH_SUPPORT)
            target_precompile_headers(${ARGV})
        endif()
    endif()
endmacro()


189
add_subdirectory(src)
190
add_subdirectory(agents)
Laurent Montel's avatar
Laurent Montel committed
191
add_subdirectory(ktnef)
192
add_subdirectory(kmail-refresh-settings)
193
ecm_qt_install_logging_categories(
Laurent Montel's avatar
Laurent Montel committed
194
195
196
197
        EXPORT KMAIL
        FILE kmail.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )
Laurent Montel's avatar
Laurent Montel committed
198

Laurent Montel's avatar
Laurent Montel committed
199
add_subdirectory(doc)
200
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
201
202
ki18n_install(po)
kdoctools_install(po)
Laurent Montel's avatar
Laurent Montel committed
203
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
204