From 76a41f3b4914809e08190969b5f212f29e223631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Glozar?= Date: Thu, 13 Jan 2022 07:27:35 +0100 Subject: [PATCH] Support building without asciidoctor Do not build bpftrace manpage and print a warning when asciidoctor is missing instead of failing to configure. Fixes #1976 --- man/adoc/CMakeLists.txt | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/man/adoc/CMakeLists.txt b/man/adoc/CMakeLists.txt index 6f785d9d747c..1a81dee00b1e 100644 --- a/man/adoc/CMakeLists.txt +++ b/man/adoc/CMakeLists.txt @@ -1,21 +1,26 @@ find_program(GZIP gzip REQUIRED) -find_program(ASCIIDOCTOR asciidoctor REQUIRED) +find_program(ASCIIDOCTOR asciidoctor) file(GLOB FILES *.adoc) set(GZFILES "") -foreach(FIL ${FILES}) - get_filename_component(NAME ${FIL} NAME_WE) - set(MANPAGE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.8) - set(GZ_MANPAGE_FILE "${MANPAGE_FILE}.gz") +if(NOT "${ASCIIDOCTOR}" STREQUAL "ASCIIDOCTOR-NOTFOUND") + foreach(FIL ${FILES}) + get_filename_component(NAME ${FIL} NAME_WE) + set(MANPAGE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.8) + set(GZ_MANPAGE_FILE "${MANPAGE_FILE}.gz") - add_custom_command(OUTPUT ${MANPAGE_FILE} - COMMAND ${ASCIIDOCTOR} ${FIL} -b manpage -o - > ${MANPAGE_FILE} - DEPENDS ${FIL}) + add_custom_command(OUTPUT ${MANPAGE_FILE} + COMMAND ${ASCIIDOCTOR} ${FIL} -b manpage -o - > ${MANPAGE_FILE} + DEPENDS ${FIL}) - add_custom_command(OUTPUT ${GZ_MANPAGE_FILE} - COMMAND ${GZIP} -c ${MANPAGE_FILE} > ${GZ_MANPAGE_FILE} - DEPENDS ${MANPAGE_FILE}) + add_custom_command(OUTPUT ${GZ_MANPAGE_FILE} + COMMAND ${GZIP} -c ${MANPAGE_FILE} > ${GZ_MANPAGE_FILE} + DEPENDS ${MANPAGE_FILE}) - list(APPEND GZFILES ${GZ_MANPAGE_FILE}) -endforeach() -add_custom_target(adoc_man DEPENDS ${GZFILES}) -install(FILES ${GZFILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8) + list(APPEND GZFILES ${GZ_MANPAGE_FILE}) + endforeach() + add_custom_target(adoc_man DEPENDS ${GZFILES}) + install(FILES ${GZFILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8) +else() + message(WARNING "asciidoctor not found, building without bpftrace manpage") + add_custom_target(adoc_man) +endif()