From 53668365d1605c21a56db6afb078ef480dbec1b2 Mon Sep 17 00:00:00 2001 From: Tobias Rehbein Date: Sun, 21 Jan 2024 13:20:01 +0100 Subject: [PATCH] cmake: sphinx is a hard dependency for manpages If the user requests to build manpages by setting `FREECIV_ENABLE_MANPAGES` to `ON`, `sphinx` is now treated as a hard dependency. While here simplify the code and re-add the default option set to `OFF`, as requested per review. --- docs/CMakeLists.txt | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) 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)