mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
cmake: simplify manpage generation
This commit is contained in:
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
|
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sway.1.txt
|
|
||||||
)
|
|
||||||
|
|
||||||
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5
|
function (add_manpage name section)
|
||||||
COMMAND ${A2X_COMMAND} --no-xmllint --doctype manpage --format manpage
|
add_custom_command(
|
||||||
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR}/sway.5.txt
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}"
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sway.5.txt
|
COMMAND "${A2X_COMMAND}"
|
||||||
)
|
--no-xmllint
|
||||||
|
--doctype manpage
|
||||||
|
--format manpage
|
||||||
|
-D "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt"
|
||||||
|
COMMENT "Generating manpage for ${name}.${section}")
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(man ALL
|
add_custom_target("man-${name}.${section}"
|
||||||
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
|
DEPENDS
|
||||||
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5)
|
"${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}")
|
||||||
|
add_dependencies(man
|
||||||
|
"man-${name}.${section}")
|
||||||
|
|
||||||
INSTALL(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
|
FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}"
|
||||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
|
DESTINATION "share/man/man${section}"
|
||||||
)
|
COMPONENT documentation)
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
INSTALL(
|
add_manpage(sway 1)
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5
|
add_manpage(sway 5)
|
||||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man5
|
|
||||||
)
|
|
||||||
|
|
||||||
INSTALL(
|
INSTALL(
|
||||||
FILES ${PROJECT_SOURCE_DIR}/sway.desktop
|
FILES ${PROJECT_SOURCE_DIR}/sway.desktop
|
||||||
|
|
Loading…
Reference in a new issue