Skip to content

Commit

Permalink
Add generating a manpage using help2man to CMakeLists.txt
Browse files Browse the repository at this point in the history
Generates a man page using help2man. Note:

- The version in CMakeLists.txt now needs to be updated on every
  release, it is used in the man page.

- help2man is a new build dependency.

- Packagers should add the generated man page to packages.
  • Loading branch information
Lukáš Hrázký authored and Conan-Kudo committed Jun 17, 2019
1 parent b00e2ad commit a1c777a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required (VERSION 2.8.5)
project (microdnf C)
set (PROJECT_VERSION 3.0.1)

list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

Expand All @@ -25,6 +26,25 @@ set (PKG_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}/dnf)
add_definitions (-DPACKAGE_LIBDIR="${PKG_LIBDIR}")
add_definitions (-DPACKAGE_DATADIR="${PKG_DATADIR}")

find_file (HELP2MAN_EXECUTABLE help2man)
if (NOT HELP2MAN_EXECUTABLE)
message (FATAL_ERROR "unable to find help2man")
endif ()

set (MANPAGE ${CMAKE_CURRENT_BINARY_DIR}/microdnf.8)
add_custom_command (
DEPENDS microdnf
OUTPUT ${MANPAGE}
COMMAND ${HELP2MAN_EXECUTABLE} $<TARGET_FILE:microdnf>
--version-string=${PROJECT_VERSION}
--no-info
--section=8
--name="Micro DNF"
--output=${MANPAGE}
)
add_custom_target (manpage ALL DEPENDS ${MANPAGE})
install (FILES ${MANPAGE} DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man8)

include_directories (${GLIB_INCLUDE_DIRS})
include_directories (${GOBJECT_INCLUDE_DIRS})
include_directories (${PEAS_INCLUDE_DIRS})
Expand Down

0 comments on commit a1c777a

Please sign in to comment.