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
|
From f9e0be7a43665a7020e4bfffde0f48b332ec366b Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Fri, 14 May 2021 12:38:57 +0200
Subject: [PATCH] Use BUILD_TESTING to make tests optional
Variable is provided by KDECMakeSettings and default enabled.
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
CMakeLists.txt | 6 +++++-
libdiscover/CMakeLists.txt | 4 +++-
libdiscover/backends/DummyBackend/CMakeLists.txt | 4 +++-
libdiscover/backends/FlatpakBackend/CMakeLists.txt | 4 +++-
libdiscover/backends/KNSBackend/CMakeLists.txt | 4 +++-
5 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73061dde..7d230317 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
-find_package(Qt5 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Test Network Xml Concurrent DBus Quick X11Extras)
+find_package(Qt5 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Network Xml Concurrent DBus Quick X11Extras)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
@@ -23,6 +23,10 @@ include(ECMQtDeclareLoggingCategory)
include(KDEClangFormat)
include(KDEGitCommitHooks)
+if(BUILD_TESTING)
+ find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED)
+endif()
+
find_package(PkgConfig REQUIRED)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED CoreAddons Config Crash DBusAddons I18n Archive XmlGui ItemModels KIO Declarative KCMUtils IdleTime)
diff --git a/libdiscover/CMakeLists.txt b/libdiscover/CMakeLists.txt
index 661c371b..56c72008 100644
--- a/libdiscover/CMakeLists.txt
+++ b/libdiscover/CMakeLists.txt
@@ -4,7 +4,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-paths.h.cmake ${CMAKE_CURRENT_
add_subdirectory(backends)
add_subdirectory(notifiers)
-add_subdirectory(tests)
+if(BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
set(discovercommon_SRCS
Category/Category.cpp
diff --git a/libdiscover/backends/DummyBackend/CMakeLists.txt b/libdiscover/backends/DummyBackend/CMakeLists.txt
index 5b4aef10..38377d80 100644
--- a/libdiscover/backends/DummyBackend/CMakeLists.txt
+++ b/libdiscover/backends/DummyBackend/CMakeLists.txt
@@ -1,4 +1,6 @@
-add_subdirectory(tests)
+if(BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
set(dummy-backend_SRCS
DummyResource.cpp
diff --git a/libdiscover/backends/FlatpakBackend/CMakeLists.txt b/libdiscover/backends/FlatpakBackend/CMakeLists.txt
index 2006a829..810238f0 100644
--- a/libdiscover/backends/FlatpakBackend/CMakeLists.txt
+++ b/libdiscover/backends/FlatpakBackend/CMakeLists.txt
@@ -1,4 +1,6 @@
-add_subdirectory(tests)
+if(BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
set(flatpak-backend_SRCS
FlatpakResource.cpp
diff --git a/libdiscover/backends/KNSBackend/CMakeLists.txt b/libdiscover/backends/KNSBackend/CMakeLists.txt
index e2cb4e52..195cb98a 100644
--- a/libdiscover/backends/KNSBackend/CMakeLists.txt
+++ b/libdiscover/backends/KNSBackend/CMakeLists.txt
@@ -1,4 +1,6 @@
-add_subdirectory(tests)
+if(BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
add_library(kns-backend MODULE
KNSBackend.cpp
--
2.31.1
|