Skip to content

Commit

Permalink
cmake: sphinx is a hard dependency for manpages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blabber authored and lmoureaux committed Jan 21, 2024
1 parent ecf8bf6 commit 5366836
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.")
Expand All @@ -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)

0 comments on commit 5366836

Please sign in to comment.