Skip to content

Commit

Permalink
[build] Make building documentation configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Artturin committed Jul 12, 2024
1 parent f87bca6 commit 2002cda
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.10)

project(NGS)

option(BUILD_MAN "Build documentation" ON)
option(INSTALL_EXAMPLE_SCRIPTS "Install example scripts" OFF)

include(CheckFunctionExists)
Expand Down Expand Up @@ -125,7 +126,14 @@ add_custom_command(

target_link_libraries(ngs m Threads::Threads ${CMAKE_DL_LIBS} ${LIBGC_LIBRARIES} ${LIBFFI_LIBRARIES} ${JSONC_LIBRARIES} ${PCRE_LIBRARIES} ${Backtrace_LIBRARY})

add_custom_target(man ALL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc COMMAND make man DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/doc/*.1.md)
if(BUILD_MAN)
add_custom_target(man ALL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc COMMAND make man DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/doc/*.1.md)
find_program(PANDOC pandoc)
if(NOT PANDOC)
message(FATAL_ERROR "Could not find pandoc")
endif()
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/ DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 FILES_MATCHING PATTERN "*.1")
endif()


install(FILES "${PROJECT_BINARY_DIR}/ngs" DESTINATION ${CMAKE_INSTALL_BINDIR})
Expand All @@ -140,7 +148,6 @@ if(INSTALL_EXAMPLE_SCRIPTS)
)
endif()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/ DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 FILES_MATCHING PATTERN "*.1")

enable_testing()
add_test(all bash -c "${CMAKE_CURRENT_BINARY_DIR}/ngs ${CMAKE_CURRENT_SOURCE_DIR}/test.ngs")

0 comments on commit 2002cda

Please sign in to comment.