Skip to content

Commit

Permalink
Added a new function for building manpages.
Browse files Browse the repository at this point in the history
  • Loading branch information
xvitaly committed Oct 12, 2024
1 parent ea5048a commit 0ba14b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ endif()

if (BUILD_MANPAGE)
configure_file("assets/manpage/${APP_NAME}.md.in" "${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}.md" @ONLY)
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}.1" COMMAND "${Pandoc_EXECUTABLE}" ARGS "${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}.md" -s -t man -o "${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}.1" COMMENT "Building manpage using Pandoc." VERBATIM)
build_manpage("${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}.md" "${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}.1")
add_custom_target(${MAN_NAME} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}.1")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
endif()
Expand Down
11 changes: 11 additions & 0 deletions cmake/FindPandoc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,15 @@ if (BUILD_MANPAGE)
REQUIRED
)
mark_as_advanced(Pandoc_EXECUTABLE)

function(build_manpage SrcName DestName)
add_custom_command(
OUTPUT "${DestName}"
COMMAND "${Pandoc_EXECUTABLE}"
ARGS "${SrcName}" -s -t man -o "${DestName}"
DEPENDS "${SrcName}"
COMMENT "Building the ${DestName} manpage using Pandoc."
VERBATIM
)
endfunction()
endif()

0 comments on commit 0ba14b3

Please sign in to comment.