lgogdownloader/man/CMakeLists.txt
Sandy Carter a5cc950192 CMake: Convert Makefile build to CMake
Find libraries using cmake/Find*.cmake scripts
Replace Version String with CMake implementation based on CMake Version and
git ref-parse.
Compile manpages in man/CMakeLists.txt to build:
    cmake .
    make manpage
Set debug and release versions with
    cmake -DCMAKE_BUILD_TYPE=Debug
and
    cmake -DCMAKE_BUILD_TYPE=Release
Build and install process can be:
    cmake -DCMAKE_BUILD_TYPE=Release .
    make
    make install
More build options can be found with
    cmake .
    make help
Codeblocks project can be generated using
    cmake -G "CodeBlocks - Unix Makefiles" .
2016-01-03 16:50:29 -05:00

23 lines
979 B
CMake

find_program(HELP2MAN help2man DOC "Location of the help2man program")
find_program(GZIP gzip DOC "Location of the gzip program")
mark_as_advanced(HELP2MAN)
mark_as_advanced(GZIP)
if(HELP2MAN AND GZIP)
set(H2M_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.supplemental.groff)
set(MAN_PAGE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1)
set(MAN_FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1.gz)
add_custom_command(
OUTPUT ${MAN_FILE}
COMMAND ${HELP2MAN} -N -i ${H2M_FILE} -o ${MAN_PAGE} ${PROJECT_BINARY_DIR}/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}
COMMAND ${GZIP} -f -9 ${MAN_PAGE}
MAIN_DEPENDENCY ${H2M_FILE}
COMMENT "Building man page"
VERBATIM
)
add_custom_target(manpage ALL DEPENDS ${MAN_FILE} ${PROJECT_NAME})
install(FILES ${MAN_FILE} DESTINATION ${INSTALL_SHARE_DIR}/man/man1)
else(HELP2MAN AND GZIP)
message("WARNING: One of the following is missing: help2man, gzip; man page will not be generated")
endif(HELP2MAN AND GZIP)