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/
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
|
||||
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_target(man ALL)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5
|
||||
COMMAND ${A2X_COMMAND} --no-xmllint --doctype manpage --format manpage
|
||||
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR}/sway.5.txt
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sway.5.txt
|
||||
)
|
||||
function (add_manpage name section)
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}"
|
||||
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
|
||||
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
|
||||
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5)
|
||||
add_custom_target("man-${name}.${section}"
|
||||
DEPENDS
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}")
|
||||
add_dependencies(man
|
||||
"man-${name}.${section}")
|
||||
|
||||
INSTALL(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
|
||||
)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}"
|
||||
DESTINATION "share/man/man${section}"
|
||||
COMPONENT documentation)
|
||||
endfunction ()
|
||||
|
||||
INSTALL(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man5
|
||||
)
|
||||
add_manpage(sway 1)
|
||||
add_manpage(sway 5)
|
||||
|
||||
INSTALL(
|
||||
FILES ${PROJECT_SOURCE_DIR}/sway.desktop
|
||||
|
|
Loading…
Reference in a new issue