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
This commit is contained in:
patrick96 2020-10-03 14:54:20 +02:00 committed by Patrick Ziegler
parent bb15e33a2a
commit 91e31317a7

View File

@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# Only used if documentation is built on its own # Only used if documentation is built on its own
project(polybar-doc NONE) 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") set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build")
separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}") separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}")