From 07200f445a64c73c153ec8835f4c1460d2bca377 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 12 Oct 2018 16:01:54 +0800 Subject: [PATCH] find sphinx-build before calling build.py this allows us to use sphinx-build-3, as user might already in a python3 world, and distros, like fedora 28, tend to add a "-3" suffix to sphinx-build. Signed-off-by: Kefu Chai --- doc/CMakeLists.txt | 5 ++++- doc/build.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index c16427a9..26fdf3d1 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -4,8 +4,11 @@ if (NOT DOXYGEN) return () endif () +find_program(SPHINX_EXECUTABLE + NAMES sphinx-build sphinx-build-3) add_custom_target(doc - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION} + COMMAND ${CMAKE_COMMAND} -E env SPHINX_EXECUTABLE=${SPHINX_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION}) SOURCES api.rst syntax.rst build.py conf.py _templates/layout.html) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ diff --git a/doc/build.py b/doc/build.py index e44ad7c3..317d0305 100755 --- a/doc/build.py +++ b/doc/build.py @@ -100,7 +100,8 @@ def build_docs(version='dev', **kwargs): raise CalledProcessError(p.returncode, cmd) html_dir = os.path.join(work_dir, 'html') main_versions = reversed(versions[-3:]) - check_call(['sphinx-build', + sphinx_build = os.environ.get('SPHINX_EXECUTABLE', 'sphinx-build') + check_call([sphinx_build, '-Dbreathe_projects.format=' + os.path.abspath(doxyxml_dir), '-Dversion=' + version, '-Drelease=' + version, '-Aversion=' + version, '-Aversions=' + ','.join(main_versions),