cmake: use GNUInstallDirs for easier packaging.

This commit is contained in:
Thomas Klausner 2017-08-29 11:52:40 +02:00
parent 638590ccfd
commit da9afb175f

View File

@ -3,6 +3,8 @@ find_program(GZIP gzip DOC "Location of the gzip program")
mark_as_advanced(HELP2MAN) mark_as_advanced(HELP2MAN)
mark_as_advanced(GZIP) mark_as_advanced(GZIP)
include(GNUInstallDirs)
if(HELP2MAN AND GZIP) if(HELP2MAN AND GZIP)
set(H2M_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.supplemental.groff) set(H2M_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.supplemental.groff)
set(MAN_PAGE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1) set(MAN_PAGE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1)
@ -16,7 +18,7 @@ if(HELP2MAN AND GZIP)
VERBATIM VERBATIM
) )
add_custom_target(manpage ALL DEPENDS ${MAN_FILE} ${PROJECT_NAME}) add_custom_target(manpage ALL DEPENDS ${MAN_FILE} ${PROJECT_NAME})
install(FILES ${MAN_FILE} DESTINATION ${INSTALL_SHARE_DIR}/man/man1) install(FILES ${MAN_FILE} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
else(HELP2MAN AND GZIP) else(HELP2MAN AND GZIP)
message("WARNING: One of the following is missing: help2man, gzip; man page will not be generated") message("WARNING: One of the following is missing: help2man, gzip; man page will not be generated")
endif(HELP2MAN AND GZIP) endif(HELP2MAN AND GZIP)