Changeset 1770 in CLRX


Ignore:
Timestamp:
Dec 1, 2015, 4:35:21 PM (4 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Fixed Unix man building. Now the documentation's building is optional and depends on utilities which are installed in system.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/cmake/Pod2Man.cmake

    r1614 r1770  
    11#
    22# Copyright (C) 2013    Emmanuel Roullit <emmanuel.roullit@gmail.com>
     3# Modified: Mateusz Szpakowski
    34#
    45
     
    89# invoke POD2MAN(<podfile> <manfile> <section>)
    910
     11# original sources: https://github.com/markusa/netsniff-ng_filter/blob/master/src/cmake/modules/Pod2Man.cmake
     12
    1013MACRO(POD2MAN PODFILE MANFILE SECTION)
    1114    FIND_PROGRAM(POD2MAN pod2man)
    1215    FIND_PROGRAM(GZIP gzip)
    1316
    14     IF(NOT POD2MAN)
    15         MESSAGE(FATAL ERROR "Need pod2man installed to generate man page")
    16     ENDIF(NOT POD2MAN)
     17    IF(POD2MAN AND GZIP)
     18        IF(NOT EXISTS ${PODFILE})
     19            MESSAGE(FATAL_ERROR "Could not find pod file ${PODFILE} to generate man page")
     20        ENDIF(NOT EXISTS ${PODFILE})
    1721
    18     IF(NOT GZIP)
    19         MESSAGE(FATAL ERROR "Need gzip installed to compress man page")
    20     ENDIF(NOT GZIP)
     22        ADD_CUSTOM_COMMAND(
     23            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
     24            DEPENDS ${PODFILE}
     25            COMMAND ${POD2MAN}
     26            ARGS --section ${SECTION} --center ${CMAKE_PROJECT_NAME} --release --stderr --name ${MANFILE}
     27            ${PODFILE} > ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
     28        )
    2129
    22     IF(NOT EXISTS ${PODFILE})
    23         MESSAGE(FATAL ERROR "Could not find pod file ${PODFILE} to generate man page")
    24     ENDIF(NOT EXISTS ${PODFILE})
     30        ADD_CUSTOM_COMMAND(
     31            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
     32            COMMAND ${GZIP} --best -c ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION} > ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
     33            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
     34        )
    2535
    26     ADD_CUSTOM_COMMAND(
    27         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
    28         DEPENDS ${PODFILE}
    29         COMMAND ${POD2MAN}
    30         ARGS --section ${SECTION} --center ${CMAKE_PROJECT_NAME} --release --stderr --name ${MANFILE}
    31         ${PODFILE} > ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
    32     )
     36        SET(MANPAGE_TARGET "man-${MANFILE}")
    3337
    34     ADD_CUSTOM_COMMAND(
    35         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
    36         COMMAND ${GZIP} --best -c ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION} > ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
    37         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}
    38     )
     38        ADD_CUSTOM_TARGET(${MANPAGE_TARGET} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz)
     39        ADD_DEPENDENCIES(man ${MANPAGE_TARGET})
    3940
    40     SET(MANPAGE_TARGET "man-${MANFILE}")
    41 
    42     ADD_CUSTOM_TARGET(${MANPAGE_TARGET} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz)
    43     ADD_DEPENDENCIES(man ${MANPAGE_TARGET})
    44 
    45     INSTALL(
    46         FILES ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
    47         DESTINATION share/man/man${SECTION}
    48         )
     41        INSTALL(
     42            FILES ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
     43            DESTINATION share/man/man${SECTION}
     44            )
     45    ELSE(POD2MAN AND GZIP)
     46        MESSAGE(WARNING "No Pod2Man or gzip. Unix manuals will not be generated")
     47    ENDIF(POD2MAN AND GZIP)
    4948ENDMACRO(POD2MAN PODFILE MANFILE SECTION)
    5049
     
    5352    # Run hard-coded 'make man' when 'make install' is invoked
    5453    INSTALL(CODE "EXECUTE_PROCESS(COMMAND make man)")
    55     ADD_CUSTOM_TARGET(man)
     54    ADD_CUSTOM_TARGET(man ALL)
    5655ENDMACRO(ADD_MANPAGE_TARGET)
Note: See TracChangeset for help on using the changeset viewer.