blob: 84e192919c7816d2e09ec606f3d912e1b025d1a6 (
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
|
From 36e435f059ee44da78e6900fded348709ea865df Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Sat, 11 Jul 2020 23:04:16 +0200
Subject: [PATCH] ECMAddTests.cmake: Skip ecm_add_test early if Qt::Test is not
available
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
modules/ECMAddTests.cmake | 9 +++++++++
tests/ECMAddTests/CMakeLists.txt | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/modules/ECMAddTests.cmake b/modules/ECMAddTests.cmake
index 58c78d05..994ed1e4 100644
--- a/modules/ECMAddTests.cmake
+++ b/modules/ECMAddTests.cmake
@@ -84,6 +84,10 @@ function(ecm_add_test)
message(FATAL_ERROR "ecm_add_test() called with multiple source files but without setting \"TEST_NAME\"")
endif()
+ if(NOT TARGET Qt::Test)
+ return()
+ endif()
+
set(_testname ${ARG_NAME_PREFIX}${_targetname})
set(gui_args)
if(ARG_GUI)
@@ -127,6 +131,11 @@ function(ecm_add_tests)
endif()
set(test_names)
set(target_names)
+
+ if(NOT TARGET Qt::Test)
+ return()
+ endif()
+
foreach(_test_source ${ARG_UNPARSED_ARGUMENTS})
ecm_add_test(${_test_source}
NAME_PREFIX ${ARG_NAME_PREFIX}
diff --git a/tests/ECMAddTests/CMakeLists.txt b/tests/ECMAddTests/CMakeLists.txt
index aa7e73a1..f9fb10cb 100644
--- a/tests/ECMAddTests/CMakeLists.txt
+++ b/tests/ECMAddTests/CMakeLists.txt
@@ -4,6 +4,11 @@ else()
set(QT_VERSION_OPT "-DBUILD_WITH_QT6=OFF")
endif()
+if(NOT TARGET Qt::Test)
+ message(STATUS "WARNING: skipping tests that require Qt::Test")
+ return()
+endif()
+
macro(add_check NAME)
string(REPLACE "." "/" dir "${NAME}")
string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
--
2.35.1
|