2017-07-04 16:00:13 -04:00
|
|
|
find_package(A2X)
|
2015-12-01 22:22:39 +02:00
|
|
|
|
2017-07-04 16:00:13 -04:00
|
|
|
if (A2X_FOUND)
|
|
|
|
|
add_custom_target(man ALL)
|
|
|
|
|
endif()
|
2017-08-14 18:26:05 -04:00
|
|
|
|
|
|
|
|
function(add_manpage name section locale)
|
|
|
|
|
if (NOT A2X_FOUND)
|
|
|
|
|
return()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if (${locale} STREQUAL "en")
|
|
|
|
|
set(
|
|
|
|
|
input
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/man/${name}.${section}.txt
|
|
|
|
|
)
|
|
|
|
|
set(
|
|
|
|
|
output
|
|
|
|
|
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
|
|
|
|
|
)
|
|
|
|
|
set(
|
|
|
|
|
destination
|
|
|
|
|
${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/man${section}
|
|
|
|
|
)
|
|
|
|
|
else()
|
|
|
|
|
set(
|
|
|
|
|
input
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/man/${name}.${section}.${locale}.txt
|
|
|
|
|
)
|
|
|
|
|
set(
|
|
|
|
|
output
|
|
|
|
|
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}.${locale}
|
|
|
|
|
)
|
|
|
|
|
set(
|
|
|
|
|
destination
|
|
|
|
|
${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/${locale}/man${section}
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
|
OUTPUT ${output}
|
|
|
|
|
COMMAND ${A2X_COMMAND}
|
|
|
|
|
--no-xmllint
|
|
|
|
|
--doctype manpage
|
|
|
|
|
--format manpage
|
|
|
|
|
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
|
|
|
|
${input}
|
|
|
|
|
DEPENDS ${input}
|
|
|
|
|
COMMENT Generating manpage for ${name}.${section}.${locale}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_custom_target(man-${name}.${section}.${locale}
|
|
|
|
|
DEPENDS ${output}
|
|
|
|
|
)
|
|
|
|
|
add_dependencies(man
|
|
|
|
|
man-${name}.${section}.${locale}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
install(
|
|
|
|
|
FILES ${output}
|
|
|
|
|
DESTINATION ${destination}
|
|
|
|
|
COMPONENT documentation
|
|
|
|
|
RENAME ${name}.${section}
|
|
|
|
|
)
|
|
|
|
|
endfunction()
|