fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Daniel Rainerformat: use 4-space indents in more filesc5e4fed02

master
2.0 KiB60 linesraw
1include(FeatureSummary)
2
3set(SPHINX_OUTPUT_DIR "${FISH_RUST_BUILD_DIR}/fish-docs")
4
5set(FISH_INDENT_FOR_BUILDING_DOCS "" CACHE FILEPATH "Path to fish_indent executable for building HTML docs")
6
7if(FISH_INDENT_FOR_BUILDING_DOCS)
8    set(SPHINX_HTML_FISH_INDENT_DEP)
9else()
10    set(FISH_INDENT_FOR_BUILDING_DOCS "${CMAKE_CURRENT_BINARY_DIR}/fish_indent")
11    set(SPHINX_HTML_FISH_INDENT_DEP fish_indent)
12endif()
13
14set(VARS_FOR_CARGO_SPHINX_WRAPPER
15    "CARGO_TARGET_DIR=${FISH_RUST_BUILD_DIR}"
16    "FISH_SPHINX=${SPHINX_EXECUTABLE}"
17)
18
19add_custom_target(sphinx-docs
20    COMMAND env ${VARS_FOR_CARGO_SPHINX_WRAPPER}
21        ${Rust_CARGO} xtask html-docs --fish-indent=${FISH_INDENT_FOR_BUILDING_DOCS}
22    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
23    DEPENDS ${SPHINX_HTML_FISH_INDENT_DEP}
24    COMMENT "Building HTML documentation with Sphinx")
25
26add_custom_target(sphinx-manpages
27    COMMAND env ${VARS_FOR_CARGO_SPHINX_WRAPPER}
28        ${Rust_CARGO} xtask man-pages
29    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
30    COMMENT "Building man pages with Sphinx")
31
32if(NOT DEFINED WITH_DOCS) # Don't check for legacy options if the new one is defined, to help bisecting.
33    if(DEFINED BUILD_DOCS)
34        message(FATAL_ERROR "the BUILD_DOCS option is no longer supported, use -DWITH_DOCS=ON|OFF")
35    endif()
36    if(DEFINED INSTALL_DOCS)
37        message(FATAL_ERROR "the INSTALL_DOCS option is no longer supported, use -DWITH_DOCS=ON|OFF")
38    endif()
39endif()
40
41if(SPHINX_EXECUTABLE)
42    option(WITH_DOCS "build documentation (requires Sphinx)" ON)
43else()
44    option(WITH_DOCS "build documentation (requires Sphinx)" OFF)
45endif()
46
47if(WITH_DOCS AND NOT SPHINX_EXECUTABLE)
48    message(FATAL_ERROR "build documentation selected, but sphinx-build could not be found")
49endif()
50
51add_feature_info(Documentation WITH_DOCS "user manual and documentation")
52
53if(WITH_DOCS)
54    add_custom_target(doc ALL DEPENDS sphinx-docs sphinx-manpages)
55    # Group docs targets into a DocsTargets folder
56    set_property(
57        TARGET doc sphinx-docs sphinx-manpages
58        PROPERTY FOLDER cmake/DocTargets
59    )
60endif()