File: 2001-Make-timed-support-optional.patch

package info (click to toggle)
mkcal 0.7.28%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 704 kB
  • sloc: cpp: 8,036; perl: 28; xml: 16; makefile: 15
file content (75 lines) | stat: -rw-r--r-- 2,161 bytes parent folder | download | duplicates (2)
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
From: Guido Berhoerster <guido+freiesoftware@berhoerster.name>
Subject: Make timed support optional

---
 CMakeLists.txt       | 4 ++--
 src/CMakeLists.txt   | 8 ++++++--
 tests/CMakeLists.txt | 8 ++++++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54f2d51..ea66d1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,8 +29,8 @@ set(QT_MIN_VERSION "5.6.0")
 find_package(Qt5 ${QT_MIN_VERSION} COMPONENTS DBus Gui Test REQUIRED)
 find_package(KF5 COMPONENTS CalendarCore REQUIRED)
 
-pkg_check_modules(TIMED timed-qt5 IMPORTED_TARGET REQUIRED)
-set_property(GLOBAL APPEND PROPERTY _CMAKE_timed-qt5_TYPE REQUIRED)
+pkg_check_modules(TIMED timed-qt5 IMPORTED_TARGET)
+set_property(GLOBAL APPEND PROPERTY _CMAKE_timed-qt5_TYPE OPTIONAL)
 pkg_check_modules(SQLITE3 sqlite3 IMPORTED_TARGET REQUIRED)
 set_property(GLOBAL APPEND PROPERTY _CMAKE_sqlite3_TYPE REQUIRED)
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bf9d425..8ad2356 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -34,7 +34,6 @@ target_link_libraries(mkcal-qt5
 		PRIVATE
 	Qt5::DBus
 	PkgConfig::SQLITE3
-	PkgConfig::TIMED
 		PUBLIC
 	Qt5::Gui
 	KF5::CalendarCore)
@@ -45,7 +44,12 @@ set_target_properties(mkcal-qt5 PROPERTIES
 
 add_definitions(-fvisibility=hidden -fvisibility-inlines-hidden)
 add_definitions(-DMKCALPLUGINDIR="${CMAKE_INSTALL_FULL_LIBDIR}/mkcalplugins")
-add_definitions(-DTIMED_SUPPORT)
+if(TIMED_FOUND)
+	add_definitions(-DTIMED_SUPPORT)
+	target_link_libraries(mkcal-qt5
+			PRIVATE
+		PkgConfig::TIMED)
+endif()
 
 # Install the library
 install(TARGETS mkcal-qt5
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c7d33c0..80a1a3c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -12,11 +12,15 @@ target_link_libraries(tst_storage
 	Qt5::Test
 	KF5::CalendarCore
 	PkgConfig::SQLITE3
-	PkgConfig::TIMED
 	mkcal-qt5)
 
 add_test(tst_storage tst_storage)
-add_definitions(-DTIMED_SUPPORT)
+if(TIMED_FOUND)
+	add_definitions(-DTIMED_SUPPORT)
+	target_link_libraries(mkcal-qt5
+			PRIVATE
+		PkgConfig::TIMED)
+endif()
 
 set(SRC_PERF
 	tst_perf.cpp)
-- 
2.34.1