50 lines
1.8 KiB
CMake
50 lines
1.8 KiB
CMake
# This file is part of the Owl Positioning System (OwlPS) project.
|
|
# It is subject to the copyright notice and license terms in the
|
|
# COPYRIGHT.t2t file found in the top-level directory of this
|
|
# distribution and at
|
|
# http://code.lm7.fr/p/owlps/source/tree/master/COPYRIGHT.t2t
|
|
# No part of the OwlPS Project, including this file, may be copied,
|
|
# modified, propagated, or distributed except according to the terms
|
|
# contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
|
|
# distributed along with this file, either separately or by replacing
|
|
# this notice by the COPYRIGHT.t2t file's contents.
|
|
|
|
|
|
### Man pages ###
|
|
|
|
set(MAN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/man")
|
|
set(PREPROC_MAN ./preproc-man.sh)
|
|
|
|
add_custom_target(doc ALL true)
|
|
|
|
function(add_manpage PAGENAME SECTION)
|
|
set(OUTPUT_DIRECTORY "${MAN_OUTPUT_DIRECTORY}/man${SECTION}")
|
|
set(SOURCE ${PAGENAME}.t2t)
|
|
set(TARGETNAME ${PAGENAME}.${SECTION})
|
|
set(TARGET "${OUTPUT_DIRECTORY}/${TARGETNAME}")
|
|
|
|
# Create the output directory
|
|
# Note: this is done only when first calling cmake and when rebuilding
|
|
# cache; it would be nice if it could be called every time, but there
|
|
# doesn't seem to be any simple solution.
|
|
file(MAKE_DIRECTORY "${OUTPUT_DIRECTORY}")
|
|
|
|
# Command to generate the man page
|
|
add_custom_command(
|
|
OUTPUT "${TARGET}"
|
|
COMMAND "${PREPROC_MAN}" "${SOURCE}" | txt2tags -q --infile=- --outfile="${TARGET}" -t man
|
|
DEPENDS "${SOURCE}"
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
COMMENT "Generating ${TARGETNAME}")
|
|
|
|
# Set up the target
|
|
add_custom_target(${TARGETNAME} true DEPENDS "${TARGET}")
|
|
|
|
# Add the target to the "doc" meta-target
|
|
add_dependencies(doc "${TARGETNAME}")
|
|
endfunction()
|
|
|
|
add_manpage(owlps 7)
|
|
add_manpage(owlps-architecture 7)
|
|
add_manpage(owlps-client 1)
|