summaryrefslogtreecommitdiff
blob: 6ffa654be01e181c23479001bf2c2b5ffefa920f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
From 938f9796d7c84b86cde3778513941055f350ee0e Mon Sep 17 00:00:00 2001
From: Klaas Freitag <kraft@freisturz.de>
Date: Sat, 29 Apr 2023 10:37:55 +0200
Subject: [PATCH 1/3] Adopt CMake files to Akonadi prefix KPim5

(cherry picked from commit f54b317f5cd894e4063b6d4c4c3a96012c1bcb28)
---
 CMakeLists.txt       | 16 ++++++++++------
 src/CMakeLists.txt   | 13 ++++++-------
 tools/CMakeLists.txt |  6 +++---
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07e15dd..8b5374c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,9 @@ find_package(ECM REQUIRED NO_MODULE)
 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
 set(CMAKE_AUTOMOC TRUE)
 
+# Akonadi Prefix: Set this to KF5 for builds with Akonadi Libs before 5.23
+set(AKO_PREFIX "KPim5")
+
 include(KDEInstallDirs)
 include(KDECMakeSettings)
 include(ECMInstallIcons)
@@ -47,23 +50,23 @@ set_package_properties(Grantlee5 PROPERTIES
     TYPE OPTIONAL
 )
 
-find_package(KF5Akonadi)
-set_package_properties(KF5Akonadi PROPERTIES
+find_package(${AKO_PREFIX}Akonadi)
+set_package_properties(${AKO_PREFIX}Akonadi PROPERTIES
     DESCRIPTION "Library for general Access to Akonadi"
     URL "https://www.kde.org/"
     PURPOSE "Optionally used for addressbook integration"
     TYPE OPTIONAL
 )
 
-find_package(KF5AkonadiContact)
-set_package_properties(KF5AkonadiContact PROPERTIES
+find_package(${AKO_PREFIX}AkonadiContact)
+set_package_properties(${AKO_PREFIX}AkonadiContact PROPERTIES
     DESCRIPTION "Library for Accessing Contacts stored in Akonadi"
     URL "https://www.kde.org/"
     PURPOSE "Optionally used for addressbook integration"
     TYPE OPTIONAL
 )
 
-if(KF5Akonadi_FOUND AND KF5AkonadiContact_FOUND)
+if(${AKO_PREFIX}Akonadi_FOUND AND ${AKO_PREFIX}AkonadiContact_FOUND)
    add_definitions(-DHAVE_AKONADI)
 endif()
 
@@ -80,7 +83,8 @@ set(QT_DEFINITIONS "${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DE
 add_definitions(${QT_DEFINITIONS} )
 
 include_directories(${QT_INCLUDES} src)
-include_directories( /usr/include/KF5/AkonadiCore )
+include_directories( /usr/include/${AKO_PREFIX}/AkonadiCore )
+include_directories(/usr/include/${AKO_PREFIX}/)
 
 if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
         ki18n_install(po)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6eaa557..8e9b069 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,3 @@
-# include_directories(${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} external)
 
 include_directories(${QT_INCLUDES} src)
 add_subdirectory(pics)
@@ -167,13 +166,13 @@ set(KRAFT_LINK_LIBS
     ${CTEMPLATE_LIBRARIES} pthread
     Grantlee5::Templates
 )
-if(KF5Akonadi_FOUND)
+if(${AKO_PREFIX}Akonadi_FOUND)
   list(APPEND KRAFT_LINK_LIBS
-    KF5::AkonadiCore
-    KF5::AkonadiContact
-    KF5::AkonadiAgentBase
-    KF5::AkonadiWidgets
-    KF5::AkonadiXml
+    ${AKO_PREFIX}::AkonadiCore
+    ${AKO_PREFIX}::AkonadiContact
+    ${AKO_PREFIX}::AkonadiAgentBase
+    ${AKO_PREFIX}::AkonadiWidgets
+    ${AKO_PREFIX}::AkonadiXml
   )
 endif()
 
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 0c58c75..f005cfe 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -8,15 +8,15 @@ set(AUTOMOC ON)
 # For now there is only the Akonadi based address backend, and thus
 # the findcontact tool is only built if akonadi is there.
 # If there are other backends, this must be FIXED.
-if(KF5Akonadi_FOUND)
+if(${AKO_PREFIX}Akonadi_FOUND)
     add_executable(${findcontact_NAME} ${FINDCONTACT_SRC})
 
     target_link_libraries( ${findcontact_NAME}
         Qt5::Core
         Qt5::Widgets
         KF5::Contacts
-        KF5::AkonadiCore
-        KF5::AkonadiContact
+        ${AKO_PREFIX}::AkonadiCore
+        ${AKO_PREFIX}::AkonadiContact
     )
 
     ########### install files ###############
-- 
2.42.0


From 5a95547fe375d55f1bb690be14268b8a26b48204 Mon Sep 17 00:00:00 2001
From: Klaas Freitag <kraft@freisturz.de>
Date: Sat, 29 Apr 2023 22:23:27 +0200
Subject: [PATCH 2/3] use option to set AKO_PREFIX rather than an internal
 variable

(cherry picked from commit 50e090059365ddbacfd219325095f4f6c5f4aa7b)
---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b5374c..f5ecc41 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,7 +9,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modul
 set(CMAKE_AUTOMOC TRUE)
 
 # Akonadi Prefix: Set this to KF5 for builds with Akonadi Libs before 5.23
-set(AKO_PREFIX "KPim5")
+option(AKO_PREFIX "Akonadi Prefix, either KF5 or KPim5, can be set by -DAKO_PREFIX=KF5" "KPim5")
 
 include(KDEInstallDirs)
 include(KDECMakeSettings)
-- 
2.42.0


From e34c8b73ccd4d0142c7c16f8d4d4756cbacadd4d Mon Sep 17 00:00:00 2001
From: Klaas Freitag <kraft@freisturz.de>
Date: Mon, 1 May 2023 14:09:09 +0200
Subject: [PATCH 3/3] Fix Akonadi legacy detection

(cherry picked from commit 66b64505bbfbc3285ba34ccacdf454720c8e0abc)
---
 CMakeLists.txt | 8 +++++++-
 INSTALL.md     | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5ecc41..82b4e07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,8 +8,14 @@ find_package(ECM REQUIRED NO_MODULE)
 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
 set(CMAKE_AUTOMOC TRUE)
 
+option(AKONADI_LEGACY_BUILD "Build with older versions of Akonadi (KF5 Prefix)" OFF)
 # Akonadi Prefix: Set this to KF5 for builds with Akonadi Libs before 5.23
-option(AKO_PREFIX "Akonadi Prefix, either KF5 or KPim5, can be set by -DAKO_PREFIX=KF5" "KPim5")
+set(AKO_PREFIX "KPim5")
+
+if (AKONADI_LEGACY_BUILD)
+  set(AKO_PREFIX "KF5")
+endif()
+message("Akonadi Prefix is ${AKO_PREFIX}")
 
 include(KDEInstallDirs)
 include(KDECMakeSettings)
diff --git a/INSTALL.md b/INSTALL.md
index 1edd0ae..77d559c 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -59,6 +59,9 @@ These are optional to build with Akonadi Support:
 - akonadi-contact-devel
 - akonadi-devel
 
+To build with Akonadi versions before 23.04, cmake has to run wtih the
+build option `-DAKONADI_LEGACY_BUILD=ON` to use the old prefix KF5.
+
 ### Build Kraft
 
 cmake is designed so that the build process can be done in a separate
-- 
2.42.0