Debian Codegraph @

man/CMakeLists.txt

raw
1 option(NEW_DOC "Build new man pages and HTML documentation" ON)
2
3 # == Build documentation ==
4 # Stolen from https://issues.apache.org/jira/secure/attachment/12455612/AVRO-470.patch
5 if (NEW_DOC)
6 set (MAN_SRC
7 compton.1.asciidoc
8 compton-trans.1.asciidoc
9 )
10
11 find_program(ASCIIDOC_EXEC asciidoc)
12 find_program(ASCIIDOC_A2X_EXEC a2x)
13 if (ASCIIDOC_EXEC AND ASCIIDOC_A2X_EXEC)
14 foreach(_file ${MAN_SRC})
15 # get_filename_component() does not handle ".1.asciidoc"
16 # correctly
17 string(REPLACE ".asciidoc" "" _file_we "${_file}")
18 set(_file_path "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
19 set(_html_out "${_file_we}.html")
20 set(_man_out "${_file_we}")
21 add_custom_target(compton_man_${_file_we} ALL
22 COMMAND ${ASCIIDOC_A2X_EXEC} --format manpage
23 "${_file_path}"
24 DEPENDS "${_file_path}"
25 )
26 add_custom_command(
27 OUTPUT "${_html_out}"
28 COMMAND ${ASCIIDOC_EXEC} -o "${_html_out}" "${_file_path}"
29 DEPENDS "${_file_path}"
30 )
31 add_custom_target(compton_html_${_file_we} ALL
32 DEPENDS "${_html_out}"
33 )
34 endforeach(_file)
35 else(ASCIIDOC_EXEC AND ASCIIDOC_A2X_EXEC)
36 message(WARNING "asciidoc/a2x not found. New man pages and HTML documentation will not be built.")
37 endif(ASCIIDOC_EXEC AND ASCIIDOC_A2X_EXEC)
38 endif(NEW_DOC)
39
40 # == Install ==
41 include(GNUInstallDirs)
42
43 install(FILES
44 "compton.1"
45 "compton-trans.1"
46 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc)