-
Notifications
You must be signed in to change notification settings - Fork 845
/
CMakeLists.txt
56 lines (51 loc) · 1.93 KB
/
CMakeLists.txt
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
### make and install the man pages
if (UNIX)
FIND_PACKAGE(7zip)
set(AsciiDoc_FIND_QUIETLY TRUE)
FIND_PACKAGE(AsciiDoc)
set(CREATE_MAN_PAGES)
if (7ZIP_FOUND AND ASCIIDOC_FOUND AND XSLTPROC_FOUND AND DOCBOOK_FOUND)
execute_process(
COMMAND "${ASCIIDOC_BIN}"
RESULT_VARIABLE ASCIIDOC_RESULT
ERROR_QUIET
OUTPUT_QUIET
ERROR_STRIP_TRAILING_WHITESPACE)
if (ASCIIDOC_RESULT EQUAL 0)
set(CREATE_MAN_PAGES TRUE)
else (ASCIIDOC_RESULT EQUAL 0)
set(CREATE_MAN_PAGES FALSE)
message(STATUS "MAN pages will not be generated/installed (utility asciidoc is broken)")
endif (ASCIIDOC_RESULT EQUAL 0)
else (7ZIP_FOUND AND ASCIIDOC_FOUND AND XSLTPROC_FOUND AND DOCBOOK_FOUND)
set(MISSING_UTILS "")
if (NOT 7ZIP_FOUND)
set(MISSING_UTILS "${MISSING_UTILS} 7z*")
endif (NOT 7ZIP_FOUND)
if (NOT ASCIIDOC_FOUND)
set(MISSING_UTILS "${MISSING_UTILS} asciidoc")
endif (NOT ASCIIDOC_FOUND)
if (NOT XSLTPROC_FOUND)
set(MISSING_UTILS "${MISSING_UTILS} xsltproc")
endif (NOT XSLTPROC_FOUND)
if (NOT DOCBOOK_FOUND)
set(MISSING_UTILS "${MISSING_UTILS} docbook-xsl")
endif (NOT DOCBOOK_FOUND)
message(STATUS "MAN pages will not be generated/installed; missing utilit(y|ies):${MISSING_UTILS}")
endif (7ZIP_FOUND AND ASCIIDOC_FOUND AND XSLTPROC_FOUND AND DOCBOOK_FOUND)
if (CREATE_MAN_PAGES)
set(MAN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/manpages")
set(MAN_BUILD_DIR "${CMAKE_BINARY_DIR}/manpages")
set(MAN_DEST_DIR "${MANDIR}/man6")
add_custom_target(manpages ALL
COMMAND "${MAN_SOURCE_DIR}/make_manpages.sh"
"${MAN_BUILD_DIR}"
"${ASCIIDOC_BIN}"
"${XSLTPROC_BIN}"
"${DOCBOOK_XSL}"
"${7ZIP_BIN}"
WORKING_DIRECTORY "${MAN_SOURCE_DIR}")
install(DIRECTORY "${MAN_BUILD_DIR}/" DESTINATION "${MAN_DEST_DIR}" FILES_MATCHING PATTERN REGEX ".*\\.6\\.gz$")
message(STATUS "MAN pages will be installed to {INSTALL_PREFIX}/${MAN_DEST_DIR}")
endif (CREATE_MAN_PAGES)
endif (UNIX)