File: CMakeLists.txt

package info (click to toggle)
hugin 2016.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 32,072 kB
  • ctags: 11,979
  • sloc: cpp: 116,753; ansic: 6,335; python: 1,517; perl: 577; sh: 168; xml: 102; makefile: 64
file content (55 lines) | stat: -rwxr-xr-x 2,162 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Windows does not have a man page system
# TODO: it would be nice to convert the POD files to a text that is
#       useful for Windows, and put this documentation in a sensible
#       place on Windows machines
IF (WIN32)
  INSTALL(FILES fulla.html nona.txt executor_file_format.txt DESTINATION doc)
ELSE (WIN32)

# For all other systems, generate and install the man pages

FIND_PROGRAM(POD2MAN pod2man)
FIND_PROGRAM(GZIP gzip)

MACRO(install_man manfile section)
  INSTALL(FILES ${manfile} DESTINATION ${MANDIR}/man${section})
ENDMACRO(install_man)

MACRO(do_pod podfile manfile section)
  IF(EXISTS "${CMAKE_SOURCE_DIR}/doc/${podfile}")
    IF(POD2MAN AND GZIP)
      # Try to install compressed manual
      SET(outfile "${manfile}.${section}")
      # TODO: fix the unaesthetic double quotes in which the HUGIN_PACKAGE_VERSION
      # is displayed on the resulting man page
      ADD_CUSTOM_COMMAND(
        OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${outfile}.gz"
        COMMAND ${POD2MAN} --section="${section}" --release="Version: ${HUGIN_PACKAGE_VERSION}" --center=HUGIN  "${CMAKE_SOURCE_DIR}/doc/${podfile}"  "${CMAKE_CURRENT_BINARY_DIR}/${outfile}"
	COMMAND ${GZIP} "-f" "${CMAKE_CURRENT_BINARY_DIR}/${outfile}"
        DEPENDS "${CMAKE_SOURCE_DIR}/doc/${podfile}"
	VERBATIM
      )
      SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${outfile}.gz" GENERATED)
      install_man("${CMAKE_CURRENT_BINARY_DIR}/${outfile}.gz" ${section})
      LIST(APPEND ManDeps "${CMAKE_CURRENT_BINARY_DIR}/${outfile}.gz")
    ENDIF(POD2MAN AND GZIP)
  ENDIF()
ENDMACRO(do_pod)

MACRO(do_doc)
    # automatically include all pod files in the directory
    FILE(GLOB POD_FILES RELATIVE "${CMAKE_SOURCE_DIR}/doc" *.pod)
    # all our man pages go into section 1
    SET(MANSECTION 1)
    FOREACH(PODFILE ${POD_FILES})
        STRING(REGEX REPLACE "\\.pod$" "" MANFILE "${PODFILE}")
        # MESSAGE(STATUS "generating man page ${CMAKE_CURRENT_BINARY_DIR}${MANFILE}")
        do_pod(${PODFILE} ${MANFILE} ${MANSECTION})
    ENDFOREACH(PODFILE ${POD_FILES})
ENDMACRO(do_doc)

set(ManDeps)
do_doc()
ADD_CUSTOM_TARGET(ManPages ALL DEPENDS ${ManDeps})

ENDIF(WIN32)