build: make manpage compression optional

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Pierre Allegraud 2009-12-28 10:43:52 +01:00 committed by Julien Danjou
parent 8857f73ce6
commit 12d610ff2f
2 changed files with 20 additions and 10 deletions

View File

@ -185,18 +185,27 @@ if(GENERATE_MANPAGES)
OUTPUT ${manfile}
WORKING_DIRECTORY ${BUILD_DIR}/manpages
DEPENDS ${xmlfile})
add_custom_command(
COMMAND ${GZIP_EXECUTABLE} < ${manfile} > ${gzfile}
OUTPUT ${gzfile}
WORKING_DIRECTORY ${BUILD_DIR}/manpages
DEPENDS ${manfile}
VERBATIM)
set(MAN_FILES ${MAN_FILES} ${gzfile})
if(COMPRESS_MANPAGES)
add_custom_command(
COMMAND ${GZIP_EXECUTABLE} < ${manfile} > ${gzfile}
OUTPUT ${gzfile}
WORKING_DIRECTORY ${BUILD_DIR}/manpages
DEPENDS ${manfile}
VERBATIM)
set(MAN_FILES ${MAN_FILES} ${gzfile})
else()
set(MAN_FILES ${MAN_FILES} ${manfile})
endif()
# figure out in what section to install to from filename
string(REGEX REPLACE "^.*\\.([0-9])\\.gz\$" "\\1" section ${gzfile})
set(AWE_MAN${section}_FILES ${AWE_MAN${section}_FILES} ${gzfile})
if(COMPRESS_MANPAGES)
set(AWE_MAN${section}_FILES ${AWE_MAN${section}_FILES} ${gzfile})
else()
set(AWE_MAN${section}_FILES ${AWE_MAN${section}_FILES} ${manfile})
endif()
endforeach()
add_custom_target(man ALL DEPENDS ${MAN_FILES})

View File

@ -12,6 +12,7 @@ set(CMAKE_BUILD_TYPE RELEASE)
option(WITH_DBUS "build with D-BUS" ON)
option(GENERATE_MANPAGES "generate manpages" ON)
option(COMPRESS_MANPAGES "generate manpages" ON)
option(GENERATE_LUADOC "generate luadoc" ON)
link_directories(/usr/local/lib)
@ -69,14 +70,14 @@ include(FindLua51) #Due to a cmake bug, you will see Lua50 on screen
# {{{ Check if documentation can be build
if(GENERATE_MANPAGES)
if(NOT ASCIIDOC_EXECUTABLE OR NOT XMLTO_EXECUTABLE OR NOT GZIP_EXECUTABLE)
if(NOT ASCIIDOC_EXECUTABLE OR NOT XMLTO_EXECUTABLE OR (COMPRESS_MANPAGES AND NOT GZIP_EXECUTABLE))
if(NOT ASCIIDOC_EXECUTABLE)
SET(missing "asciidoc")
endif()
if(NOT XMLTO_EXECUTABLE)
SET(missing ${missing} " xmlto")
endif()
if(NOT GZIP_EXECUTABLE)
if(COMPRESS_MANPAGES AND NOT GZIP_EXECUTABLE)
SET(missing ${missing} " gzip")
endif()