Skip to content

Commit

Permalink
Merge pull request #224 from Paiusco/build-doc-optional
Browse files Browse the repository at this point in the history
Build documentation is opt-out on CMake
  • Loading branch information
ReimuNotMoe authored Feb 26, 2024
2 parents b1a909a + 187ab35 commit abc386f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions manpage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
find_program(SCDOC scdoc)
if(NOT SCDOC)
message(FATAL_ERROR "scdoc not found")
endif()

function(man_page section page)
set(src "${CMAKE_CURRENT_SOURCE_DIR}/${page}.${section}.scd")
set(bin "${CMAKE_CURRENT_BINARY_DIR}/${page}.${section}")
add_custom_target(${page}.${section} ALL COMMAND ${SCDOC} < ${src} > ${bin})
install(FILES ${bin} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}/)
endfunction(man_page)

man_page(1 ydotool)
man_page(8 ydotoold)
option(BUILD_DOCS "build documentation (requires scdoc)" ON)

find_program(SCDOC scdoc)

if(BUILD_DOCS AND NOT SCDOC)
message(FATAL_ERROR "build documentation selected, but scdoc could not be found")
endif()

if(BUILD_DOCS)
man_page(1 ydotool)
man_page(8 ydotoold)
endif()

0 comments on commit abc386f

Please sign in to comment.