Debian Codegraph @

docs/CMakeLists.txt

raw
1 #
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
9 #
10 # https://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18 #
19
20 set (AVRO_DOC_SRC
21 index.txt
22 )
23
24 # TODO(dln): Use FindAsciidoc script instead.
25 message(STATUS "Searching for asciidoc...")
26 find_program(ASCIIDOC_EXECUTABLE asciidoc)
27 find_program(SOURCE_HIGHLIGHT_EXECUTABLE source-highlight)
28
29 if (ASCIIDOC_EXECUTABLE AND SOURCE_HIGHLIGHT_EXECUTABLE)
30 foreach(_file ${AVRO_DOC_SRC})
31 get_filename_component(_file_we ${_file} NAME_WE)
32 set(_file_path "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
33 set(_html_out "${CMAKE_CURRENT_BINARY_DIR}/${_file_we}.html")
34 add_custom_command(
35 OUTPUT "${_html_out}"
36 COMMAND ${ASCIIDOC_EXECUTABLE}
37 -a avro_version=${AVRO_VERSION}
38 -a libavro_version=${LIBAVRO_VERSION}
39 -a toc
40 --unsafe -n -o "${_html_out}" "${_file_path}"
41 DEPENDS "${_file_path}"
42 COMMENT "asciidoc ${_file}"
43 )
44 install(FILES "${_html_out}" DESTINATION share/doc/avro-c)
45 add_custom_target("${_file_we}_html" ALL echo -n
46 DEPENDS "${_file}" "${_html_out}"
47 )
48 add_custom_target(docs DEPENDS "${_html_out}")
49 endforeach(_file)
50 else(ASCIIDOC_EXECUTABLE AND SOURCE_HIGHLIGHT_EXECUTABLE)
51 message(WARNING "asciidoc and/or source-highlight not found. HTML documentation will *NOT* be built.")
52 endif(ASCIIDOC_EXECUTABLE AND SOURCE_HIGHLIGHT_EXECUTABLE)
53