From b570c7f8bd089deec7da2b108aa789a27025a473 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Tue, 19 Nov 2019 13:46:09 +0100
Subject: [PATCH] Look fo sphinx only if documentation is actually enabled

Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
 docs/hawkey/CMakeLists.txt | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/docs/hawkey/CMakeLists.txt b/docs/hawkey/CMakeLists.txt
index 52cc35c6..63c7672f 100644
--- a/docs/hawkey/CMakeLists.txt
+++ b/docs/hawkey/CMakeLists.txt
@@ -2,15 +2,17 @@
 # tell sphinx-build to do them both in one go:
 
 
-find_program(SPHINX_PROGRAM NAMES "sphinx-build-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
-if(NOT EXISTS ${SPHINX_PROGRAM})
-    find_program(SPHINX_PROGRAM NAMES sphinx-build-${PYTHON_VERSION_MAJOR})
-endif()
-if(NOT EXISTS ${SPHINX_PROGRAM})
-    find_program(SPHINX_PROGRAM NAMES sphinx-build)
-endif()
-if(NOT EXISTS ${SPHINX_PROGRAM})
-    message(FATAL_ERROR "Sphinx program not found." )
+if (WITH_HTML OR WITH_MAN)
+    find_program(SPHINX_PROGRAM NAMES "sphinx-build-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
+    if(NOT EXISTS ${SPHINX_PROGRAM})
+        find_program(SPHINX_PROGRAM NAMES sphinx-build-${PYTHON_VERSION_MAJOR})
+    endif()
+    if(NOT EXISTS ${SPHINX_PROGRAM})
+        find_program(SPHINX_PROGRAM NAMES sphinx-build)
+    endif()
+    if(NOT EXISTS ${SPHINX_PROGRAM})
+        message(FATAL_ERROR "Sphinx program not found." )
+    endif()
 endif()
 
 if(WITH_HTML)
