From 91e31317a79b9de37b89b99c8abc6f74e8370fba Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sat, 3 Oct 2020 14:54:20 +0200
Subject: [PATCH] doc: Set SPHINX_BUILD in standalone doc builds
If we build only the documentation by invoking `cmake` on the `doc`
folder, the `SPHINX_BUILD` variable is not set and instead of
```
sphinx-build -b html ...
```
it will just execute
```
-b html ...
```
This produces an error but doesn't fail the build because apparently if
the command starts with a dash an error is non-fatal.
Fixes #2191
---
doc/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index b7e80b8a..fb8ad29b 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# Only used if documentation is built on its own
project(polybar-doc NONE)
+if(NOT SPHINX_BUILD)
+ set(SPHINX_BUILD "sphinx-build")
+endif()
+
set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build")
separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}")