fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
c5e4fed02
master
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) 8set ( SPHINX_HTML_FISH_INDENT_DEP ) 9else () 10set ( FISH_INDENT_FOR_BUILDING_DOCS " ${ CMAKE_CURRENT_BINARY_DIR } /fish_indent" ) 11set ( 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 20COMMAND env ${ VARS_FOR_CARGO_SPHINX_WRAPPER } 21${ Rust_CARGO } xtask html-docs --fish-indent= ${ FISH_INDENT_FOR_BUILDING_DOCS } 22WORKING_DIRECTORY " ${ CMAKE_SOURCE_DIR } " 23DEPENDS ${ SPHINX_HTML_FISH_INDENT_DEP } 24COMMENT "Building HTML documentation with Sphinx" ) 25 26add_custom_target ( sphinx-manpages 27COMMAND env ${ VARS_FOR_CARGO_SPHINX_WRAPPER } 28${ Rust_CARGO } xtask man-pages 29WORKING_DIRECTORY " ${ CMAKE_SOURCE_DIR } " 30COMMENT "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. 33if ( DEFINED BUILD_DOCS) 34message ( FATAL_ERROR "the BUILD_DOCS option is no longer supported, use -DWITH_DOCS=ON|OFF" ) 35endif () 36if ( DEFINED INSTALL_DOCS) 37message ( FATAL_ERROR "the INSTALL_DOCS option is no longer supported, use -DWITH_DOCS=ON|OFF" ) 38endif () 39endif () 40 41if ( SPHINX_EXECUTABLE) 42option ( WITH_DOCS "build documentation (requires Sphinx)" ON ) 43else () 44option ( WITH_DOCS "build documentation (requires Sphinx)" OFF ) 45endif () 46 47if ( WITH_DOCSAND NOT SPHINX_EXECUTABLE) 48message ( 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) 54add_custom_target ( doc ALL DEPENDS sphinx-docs sphinx-manpages ) 55# Group docs targets into a DocsTargets folder 56set_property ( 57TARGET doc sphinx-docs sphinx-manpages 58PROPERTY FOLDER cmake/DocTargets 59) 60endif ()