Generate a most basic manpage with help2man

This commit is contained in:
Přemysl Eric Janouch 2013-06-08 21:50:42 +02:00
parent 30ee238bbc
commit 347e6f68b2
2 changed files with 25 additions and 2 deletions

View File

@ -53,6 +53,29 @@ if (BUILD_GUI)
DESTINATION ${CMAKE_INSTALL_BINDIR}) DESTINATION ${CMAKE_INSTALL_BINDIR})
endif (BUILD_GUI) endif (BUILD_GUI)
find_program (HELP2MAN_EXECUTABLE help2man)
if (NOT HELP2MAN_EXECUTABLE)
message (FATAL_ERROR "help2man not found")
endif ()
foreach (page ${PROJECT_NAME})
set (page_output "${PROJECT_BINARY_DIR}/${page}.1")
list (APPEND project_MAN_PAGES "${page_output}")
add_custom_command (OUTPUT ${page_output}
COMMAND ${HELP2MAN_EXECUTABLE} -N
"${PROJECT_BINARY_DIR}/${page}" -o ${page_output}
DEPENDS ${PROJECT_NAME}
COMMENT "Generating man page for ${page}" VERBATIM)
endforeach ()
add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES})
foreach (page ${project_MAN_PAGES})
string (REGEX MATCH "\\.([0-9])" manpage_suffix "${page}")
install (FILES "${page}"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man${CMAKE_MATCH_1}")
endforeach ()
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "SteelSeries Sensei Raw control utility") set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "SteelSeries Sensei Raw control utility")
set (CPACK_PACKAGE_VERSION ${project_VERSION}) set (CPACK_PACKAGE_VERSION ${project_VERSION})
set (CPACK_PACKAGE_VENDOR "Premysl Janouch") set (CPACK_PACKAGE_VENDOR "Premysl Janouch")

View File

@ -281,8 +281,8 @@ struct options
static void static void
show_usage (const char *program_name) show_usage (const char *program_name)
{ {
printf ("Usage: %s [OPTION]... - configure" printf ("Usage: %s [OPTION]...\n", program_name);
" SteelSeries Sensei Raw devices\n\n", program_name); printf ("Configure SteelSeries Sensei Raw devices.\n\n");
printf (" -h, --help Show this help\n"); printf (" -h, --help Show this help\n");
printf (" --version Show program version and exit\n"); printf (" --version Show program version and exit\n");
printf (" --show Show current mouse settings and exit\n"); printf (" --show Show current mouse settings and exit\n");