cmake: simplify manpage generation

master
Ben Boeckel 9 years ago
parent c8599dba02
commit 4714262c3d

@ -72,31 +72,34 @@ INSTALL(
DESTINATION /etc/sway/ DESTINATION /etc/sway/
) )
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1 add_custom_target(man ALL)
COMMAND ${A2X_COMMAND} --no-xmllint --doctype manpage --format manpage
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR}/sway.1.txt function (add_manpage name section)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sway.1.txt add_custom_command(
) OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}"
COMMAND "${A2X_COMMAND}"
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5 --no-xmllint
COMMAND ${A2X_COMMAND} --no-xmllint --doctype manpage --format manpage --doctype manpage
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR}/sway.5.txt --format manpage
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sway.5.txt -D "${CMAKE_CURRENT_BINARY_DIR}"
) "${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt"
ADD_CUSTOM_TARGET(man ALL COMMENT "Generating manpage for ${name}.${section}")
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5) add_custom_target("man-${name}.${section}"
DEPENDS
INSTALL( "${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}")
FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1 add_dependencies(man
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 "man-${name}.${section}")
)
install(
INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}"
FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5 DESTINATION "share/man/man${section}"
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man5 COMPONENT documentation)
) endfunction ()
add_manpage(sway 1)
add_manpage(sway 5)
INSTALL( INSTALL(
FILES ${PROJECT_SOURCE_DIR}/sway.desktop FILES ${PROJECT_SOURCE_DIR}/sway.desktop

Loading…
Cancel
Save