CMakeLists.txt 4.33 KB
Newer Older
1
2
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: none
3
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
Laurent Montel's avatar
Laurent Montel committed
4
set(PIM_VERSION "5.20.40")
5
project(kaddressbook VERSION ${PIM_VERSION})
Laurent Montel's avatar
Laurent Montel committed
6
set(RELEASE_SERVICE_VERSION "22.07.40")
7
set(KF5_MIN_VERSION "5.94.0")
Laurent Montel's avatar
Laurent Montel committed
8

9
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
10
11
12
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(ECMInstallIcons)

13

Antonio Rojas's avatar
Antonio Rojas committed
14
15
include(KDEInstallDirs)
include(KDECMakeSettings)
16
include(KDECompilerSettings NO_POLICY_SCOPE)
Antonio Rojas's avatar
Antonio Rojas committed
17
18
include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory)
19
include(ECMDeprecationSettings)
Antonio Rojas's avatar
Antonio Rojas committed
20

Laurent Montel's avatar
Laurent Montel committed
21
22
include(ECMSetupVersion)
include(ECMAddTests)
23

Laurent Montel's avatar
Laurent Montel committed
24
25
include(GenerateExportHeader)
include(ECMGenerateHeaders)
26

Laurent Montel's avatar
Laurent Montel committed
27
include(FeatureSummary)
28
include(KDEGitCommitHooks)
29
30
31
include(KDEClangFormat)
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.c)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
Laurent Montel's avatar
Laurent Montel committed
32
33
34
include(CheckFunctionExists)
include(ECMGeneratePriFile)

Daniel Vrátil's avatar
Daniel Vrátil committed
35

Laurent Montel's avatar
Laurent Montel committed
36
# Do NOT add quote
Laurent Montel's avatar
Laurent Montel committed
37
set(KDEPIM_DEV_VERSION)
Laurent Montel's avatar
Laurent Montel committed
38
39
40
41

# add an extra space
if(DEFINED KDEPIM_DEV_VERSION)
    set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
Laurent Montel's avatar
Laurent Montel committed
42
endif()
Laurent Montel's avatar
Laurent Montel committed
43

44
set(KDEPIM_VERSION "${PIM_VERSION}${KDEPIM_DEV_VERSION} (${RELEASE_SERVICE_VERSION})")
Laurent Montel's avatar
Laurent Montel committed
45

Laurent Montel's avatar
Laurent Montel committed
46
47
48
set(KPIMTEXTEDIT_LIB_VERSION "5.20.40")
set(AKONADI_VERSION "5.20.40")
set(KONTACTINTERFACE_LIB_VERSION "5.20.40")
Laurent Montel's avatar
Laurent Montel committed
49

50
set(KDEPIM_LIB_VERSION "${PIM_VERSION}")
Laurent Montel's avatar
Laurent Montel committed
51
52
53
set(KDEPIM_LIB_SOVERSION "5")


54
set(QT_REQUIRED_VERSION "5.15.2")
55
find_package(Qt${QT_MAJOR_VERSION} ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test DBus PrintSupport)
Laurent Montel's avatar
Laurent Montel committed
56
57
58
59
set(LIBKDEPIM_LIB_VERSION "5.20.40")
set(LIBGRANTLEETHEME_LIB_VERSION "5.20.40")
set(PIMCOMMON_LIB_VERSION "5.20.40")
set(AKONADI_SEARCH_VERSION "5.20.40")
60
set(AKONADI_CONTACT_VERSION "5.20.41")
Laurent Montel's avatar
Laurent Montel committed
61

Laurent Montel's avatar
Laurent Montel committed
62
# Find KF5 package
63
find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
64
find_package(KF5CoreAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
65
66
find_package(KF5KCMUtils ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Crash ${KF5_MIN_VERSION} REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
67

Laurent Montel's avatar
Laurent Montel committed
68
69
70
71
72
73
find_package(KF5DocTools ${KF5_MIN_VERSION})
set_package_properties(KF5DocTools PROPERTIES DESCRIPTION
    "Tools to generate documentation"
    TYPE OPTIONAL
)

Laurent Montel's avatar
Laurent Montel committed
74
75
76
find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
find_package(KF5KontactInterface ${KONTACTINTERFACE_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
77
78
find_package(KF5Libkdepim ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED)
79
80
81
82
83
84
85
86
87
88
89
90
if (UNIX)
    find_package(KF5AkonadiSearch ${AKONADI_SEARCH_VERSION} CONFIG REQUIRED)
else()
    find_package(KF5AkonadiSearch ${AKONADI_SEARCH_VERSION} CONFIG)
    set_package_properties(KF5AkonadiSearch PROPERTIES DESCRIPTION "The Akonadi Search libraries" URL "https://invent.kde.org/pim/akonadi-search"
        TYPE OPTIONAL PURPOSE "Provides search capabilities in KAddressbook and Akonadi (only debug)")
endif()

if (NOT KF5AkonadiSearch_FOUND)
    add_definitions(-DFORCE_DISABLE_AKONADI_SEARCH)
endif()

91
find_package(KF5AkonadiContact ${AKONADI_CONTACT_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
92
find_package(KF5GrantleeTheme ${LIBGRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
93
94

include_directories(${kaddressbook_SOURCE_DIR} ${kaddressbook_BINARY_DIR})
Laurent Montel's avatar
Laurent Montel committed
95

96
find_package(KF5Prison ${KF5_MIN_VERSION} CONFIG REQUIRED)
Allen Winter's avatar
Allen Winter committed
97

98
add_definitions(-DTRANSLATION_DOMAIN=\"kaddressbook\")
99
ecm_set_disabled_deprecation_versions(QT 5.15.2
100
    KF 5.95.0
101
102
    KCOREADDONS 5.88.0 #KPluginFactory::registerPlugin
)
103

Laurent Montel's avatar
Laurent Montel committed
104

105
find_package(KUserFeedback 1.2.0 CONFIG)
Laurent Montel's avatar
Laurent Montel committed
106
set_package_properties(KUserFeedback PROPERTIES DESCRIPTION "User Feedback lib" TYPE OPTIONAL PURPOSE "Allow to send Telemetry Information (optional).")
107
108
109
110

if (TARGET KUserFeedbackWidgets)
    add_definitions(-DWITH_KUSERFEEDBACK)
endif()
111
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
112

113
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
Laurent Montel's avatar
Laurent Montel committed
114
if (USE_UNITY_CMAKE_SUPPORT)
115
116
    set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
    add_definitions(-DCOMPILE_WITH_UNITY_CMAKE_SUPPORT)
117
endif()
118

119

Laurent Montel's avatar
Laurent Montel committed
120
add_subdirectory(src)
121
add_subdirectory(kontactplugin)
Laurent Montel's avatar
Minor    
Laurent Montel committed
122

123
ecm_qt_install_logging_categories(
Laurent Montel's avatar
Laurent Montel committed
124
125
126
127
        EXPORT KADDRESSBOOK
        FILE kaddressbook.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )
Laurent Montel's avatar
Laurent Montel committed
128

129
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
130
ki18n_install(po)
131
if(KF5DocTools_FOUND)
Laurent Montel's avatar
Laurent Montel committed
132
    kdoctools_install(po)
133
134
    add_subdirectory(doc)
endif()
Laurent Montel's avatar
Laurent Montel committed
135
136

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)