diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 7a904861cb..f1e50a86cf 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,6 +1,10 @@ # CMakeLists for Freeciv21 Docs -find_package(Sphinx QUIET) +if(FREECIV_ENABLE_MANPAGES) + find_package(Sphinx REQUIRED) +else() + find_package(Sphinx QUIET) +endif() if(SPHINX_FOUND) message(STATUS "Sphinx Found, configuring.") @@ -14,18 +18,19 @@ if(SPHINX_FOUND) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating documentation with Sphinx") - # We only create man pages on Unix + # We only create man pages on Unix or if the user explicitly requested it. if((UNIX AND NOT APPLE) OR FREECIV_ENABLE_MANPAGES) option(FREECIV_ENABLE_MANPAGES "Enable manpages" ON) - if(FREECIV_ENABLE_MANPAGES) - add_custom_target(man-pages ALL - COMMAND - ${SPHINX_EXECUTABLE} -b man ${SPHINX_SOURCE} ${SPHINX_MAN} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating manual pages with Sphinx") - endif() + add_custom_target(man-pages ALL + COMMAND + ${SPHINX_EXECUTABLE} -b man ${SPHINX_SOURCE} ${SPHINX_MAN} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating manual pages with Sphinx") endif() else() message(STATUS "Sphinx NOT Found.") endif() + +# Default to OFF, if FREECIV_ENABLE_MANPAGES is not set yet. +option(FREECIV_ENABLE_MANPAGES "Enable manpages" OFF)