diff --git a/cmake/Man.cmake b/cmake/Man.cmake index 1f1ef9ec2f..5c9476c575 100644 --- a/cmake/Man.cmake +++ b/cmake/Man.cmake @@ -14,21 +14,34 @@ if (NOT GZIP) else (NOT GZIP) message (STATUS "Looking for gzip to generate manpages - found") + # macro can also be called with a third argument that contains a modified name + # of the manpage to be installed. macro(roffman _source _section) + set(_extra_macro_args ${ARGN}) + list(LENGTH _extra_macro_args _num_extra_macro_args) + + if (_num_extra_macro_args EQUAL 0) + set(_destination _source) + elseif(_num_extra_macro_args EQUAL 1) + set(_destination ${_extra_macro_args}) + else() + message(FATAL_ERROR "roffman macro called with unexpected number of extra arguments '${ARGN}'") + endif() + add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_source}.${_section}.gz + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_destination}.${_section}.gz COMMAND ${GZIP} -c ${CMAKE_CURRENT_SOURCE_DIR}/${_source}.${_section}.roff - > ${CMAKE_CURRENT_BINARY_DIR}/${_source}.${_section}.gz + > ${CMAKE_CURRENT_BINARY_DIR}/${_destination}.${_section}.gz DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_source}.${_section}.roff ) set(MANPAGE_TARGET "man-${_source}") add_custom_target(${MANPAGE_TARGET} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_source}.${_section}.gz) + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_destination}.${_section}.gz) add_dependencies(man ${MANPAGE_TARGET}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_source}.${_section}.gz + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_destination}.${_section}.gz DESTINATION share/man/man${_section} ) endmacro(roffman _source _section) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index a0ec46236e..531180cf88 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -67,7 +67,7 @@ endif() gz_install_executable(${GZ_CLI_EXECUTABLE_NAME}) if (NOT WIN32) - roffman(${GZ_CLI_EXECUTABLE_NAME} 1) + roffman(gz 1 ${GZ_CLI_EXECUTABLE_NAME}) endif() install (PROGRAMS gzprop DESTINATION ${BIN_INSTALL_DIR})