Add option to pass custom flags to sphinx-build (#15545)
Create a SPHINX_FLAGS cache entry that users can populate with command-line flags for sphinx-build. Add an option to the bootstrap script to populate it up front. Suggested-by: Felix Geyer <debfx@ubuntu.com>
This commit is contained in:
parent
6064b9072c
commit
dd107b30d2
|
@ -31,8 +31,11 @@ find_program(SPHINX_EXECUTABLE
|
||||||
NAMES sphinx-build
|
NAMES sphinx-build
|
||||||
DOC "Sphinx Documentation Builder (sphinx-doc.org)"
|
DOC "Sphinx Documentation Builder (sphinx-doc.org)"
|
||||||
)
|
)
|
||||||
|
set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build")
|
||||||
|
separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}")
|
||||||
|
|
||||||
mark_as_advanced(SPHINX_TEXT)
|
mark_as_advanced(SPHINX_TEXT)
|
||||||
|
mark_as_advanced(SPHINX_FLAGS)
|
||||||
|
|
||||||
if(NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_SINGLEHTML AND NOT SPHINX_QTHELP AND NOT SPHINX_TEXT)
|
if(NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_SINGLEHTML AND NOT SPHINX_QTHELP AND NOT SPHINX_TEXT)
|
||||||
return()
|
return()
|
||||||
|
@ -114,6 +117,7 @@ foreach(format ${doc_formats})
|
||||||
-c ${CMAKE_CURRENT_BINARY_DIR}
|
-c ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
-d ${CMAKE_CURRENT_BINARY_DIR}/doctrees
|
-d ${CMAKE_CURRENT_BINARY_DIR}/doctrees
|
||||||
-b ${format}
|
-b ${format}
|
||||||
|
${sphinx_flags}
|
||||||
${CMake_SOURCE_DIR}/Help
|
${CMake_SOURCE_DIR}/Help
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${format}
|
${CMAKE_CURRENT_BINARY_DIR}/${format}
|
||||||
> ${doc_format_log} # log stdout, pass stderr
|
> ${doc_format_log} # log stdout, pass stderr
|
||||||
|
|
|
@ -74,6 +74,7 @@ cmake_sphinx_man=""
|
||||||
cmake_sphinx_html=""
|
cmake_sphinx_html=""
|
||||||
cmake_sphinx_qthelp=""
|
cmake_sphinx_qthelp=""
|
||||||
cmake_sphinx_build=""
|
cmake_sphinx_build=""
|
||||||
|
cmake_sphinx_flags=""
|
||||||
|
|
||||||
# Determine whether this is a Cygwin environment.
|
# Determine whether this is a Cygwin environment.
|
||||||
if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
|
if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
|
||||||
|
@ -423,6 +424,7 @@ Configuration:
|
||||||
--sphinx-html build html help with Sphinx
|
--sphinx-html build html help with Sphinx
|
||||||
--sphinx-qthelp build qch help with Sphinx
|
--sphinx-qthelp build qch help with Sphinx
|
||||||
--sphinx-build=<sb> use <sb> as the sphinx-build executable
|
--sphinx-build=<sb> use <sb> as the sphinx-build executable
|
||||||
|
--sphinx-flags=<flags> pass <flags> to sphinx-build executable
|
||||||
|
|
||||||
Directory and file names:
|
Directory and file names:
|
||||||
--prefix=PREFIX install files in tree rooted at PREFIX
|
--prefix=PREFIX install files in tree rooted at PREFIX
|
||||||
|
@ -660,6 +662,7 @@ while test $# != 0; do
|
||||||
--sphinx-html) cmake_sphinx_html="1" ;;
|
--sphinx-html) cmake_sphinx_html="1" ;;
|
||||||
--sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
|
--sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
|
||||||
--sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
|
--sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
|
||||||
|
--sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
|
||||||
--help) cmake_usage ;;
|
--help) cmake_usage ;;
|
||||||
--version) cmake_version_display ; exit 2 ;;
|
--version) cmake_version_display ; exit 2 ;;
|
||||||
--verbose) cmake_verbose=TRUE ;;
|
--verbose) cmake_verbose=TRUE ;;
|
||||||
|
@ -1684,6 +1687,11 @@ if [ "x${cmake_sphinx_build}" != "x" ]; then
|
||||||
set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
|
set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
|
||||||
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
|
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
|
||||||
fi
|
fi
|
||||||
|
if [ "x${cmake_sphinx_flags}" != "x" ]; then
|
||||||
|
echo '
|
||||||
|
set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
|
||||||
|
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add user-specified settings. Handle relative-path case for
|
# Add user-specified settings. Handle relative-path case for
|
||||||
# specification of cmake_init_file.
|
# specification of cmake_init_file.
|
||||||
|
|
Loading…
Reference in New Issue