blob: d0267e328352b4864ce95e6c600fa51b311a15ea [file] [log] [blame]
Fabrice Fontainebe4869f2021-04-22 20:24:43 +02001From 03daae49c8fa94513b508bd12f1597e8e5e086f2 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Sat, 17 Apr 2021 13:06:44 +0200
4Subject: [PATCH] CMakeLists.txt: respect BUILD_TESTING
5
6Don't build tests if the standard cmake BUILD_TESTING variable is set to
7OFF.
8
9Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
10[Upstream status: https://github.com/mapbox/protozero/pull/105]
11---
12 CMakeLists.txt | 9 +++++----
13 1 file changed, 5 insertions(+), 4 deletions(-)
14
15diff --git a/CMakeLists.txt b/CMakeLists.txt
16index f9702d6..7a40212 100644
17--- a/CMakeLists.txt
18+++ b/CMakeLists.txt
19@@ -23,6 +23,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
20
21 #-----------------------------------------------------------------------------
22
23+option(BUILD_TESTING "Build tests" ON)
24 option(WERROR "Add -Werror flag to build (turns warnings into errors)" ON)
25
26 if(MSVC)
27@@ -134,13 +135,13 @@ install(DIRECTORY include/protozero DESTINATION include)
28
29 #-----------------------------------------------------------------------------
30
31-enable_testing()
32-
33 add_subdirectory(doc)
34
35 add_subdirectory(tools)
36
37-add_subdirectory(test)
38-
39+if(BUILD_TESTING)
40+ enable_testing()
41+ add_subdirectory(test)
42+endif()
43
44 #-----------------------------------------------------------------------------
45--
462.30.2
47