diff --git a/CMakeLists.txt b/CMakeLists.txt index cfd6be904..e56dd2ada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,9 +133,6 @@ ADD_DEFINITIONS(-D_REENTRANT) # Set up PCRE2 INCLUDE(cmake/PCRE2.cmake) -# Set up the docs. -INCLUDE(cmake/Docs.cmake) - # Define a function to link dependencies. FUNCTION(FISH_LINK_DEPS target) TARGET_LINK_LIBRARIES(${target} fishlib) @@ -162,6 +159,9 @@ ADD_EXECUTABLE(fish_key_reader src/fish_key_reader.cpp src/print_help.cpp) FISH_LINK_DEPS(fish_key_reader) +# Set up the docs. +INCLUDE(cmake/Docs.cmake) + # A helper for running tests. ADD_EXECUTABLE(fish_test_helper src/fish_test_helper.cpp) diff --git a/cmake/Docs.cmake b/cmake/Docs.cmake index 35005e9d1..9e2758b16 100644 --- a/cmake/Docs.cmake +++ b/cmake/Docs.cmake @@ -13,14 +13,17 @@ SET(SPHINX_CACHE_DIR "${SPHINX_ROOT_DIR}/doctrees") SET(SPHINX_HTML_DIR "${SPHINX_ROOT_DIR}/html") SET(SPHINX_MANPAGE_DIR "${SPHINX_ROOT_DIR}/man") +# sphinx-docs uses fish_indent for highlighting. +# Prepend the output dir of fish_indent to PATH. ADD_CUSTOM_TARGET(sphinx-docs - ${SPHINX_EXECUTABLE} + env PATH="$:$$PATH" + ${SPHINX_EXECUTABLE} -q -b html -c "${SPHINX_SRC_DIR}" -d "${SPHINX_CACHE_DIR}" "${SPHINX_SRC_DIR}" "${SPHINX_HTML_DIR}" - DEPENDS sphinx_doc_src/fish_indent_lexer.py + DEPENDS sphinx_doc_src/fish_indent_lexer.py fish_indent COMMENT "Building HTML documentation with Sphinx") ADD_CUSTOM_TARGET(sphinx-manpages