From f8e35a5b2076273b4f2cfca01cf1e2accb6c128a Mon Sep 17 00:00:00 2001
From: Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com>
Date: Fri, 23 Dec 2022 13:28:51 +0300
Subject: [PATCH] cmake: add option not to build doc or tests

---
 CMakeLists.txt | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f41693c51..632e394306 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -771,13 +771,21 @@ include (cmake/rpm.cmake)
 
 add_subdirectory(src)
 add_subdirectory(extra)
-add_subdirectory(test)
-if (CMAKE_BUILD_TYPE STREQUAL "Debug")
-    message(AUTHOR_WARNING "Benchmarks are available only in release build")
-else ()
-    add_subdirectory(perf)
-endif ()
-add_subdirectory(doc)
+
+option(BUILD_TESTING "Enable building tests and perftests" ON)
+if (BUILD_TESTING)
+    add_subdirectory(test)
+    if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+        message(AUTHOR_WARNING "Benchmarks are available only in release build")
+    else ()
+        add_subdirectory(perf)
+    endif ()
+endif()
+
+option(BUILD_DOC "Enable building documentation (man pages)" ON)
+if (BUILD_DOC)
+    add_subdirectory(doc)
+endif()
 
 option(WITH_NOTIFY_SOCKET "Enable notifications on NOTIFY_SOCKET" ON)
 
-- 
GitLab