docs/src/CMakeLists.txt

Mon, 30 Dec 2019 09:52:44 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 30 Dec 2019 09:52:44 +0100
changeset 388
871a8ffe6c9d
parent 372
a3e494af5c09
child 390
d345541018fa
permissions
-rw-r--r--

merges closed feature/array branch

universe@372 1 #
universe@372 2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@372 3 #
universe@372 4 # Copyright 2019 Mike Becker, Olaf Wintermann All rights reserved.
universe@372 5 #
universe@372 6 # Redistribution and use in source and binary forms, with or without
universe@372 7 # modification, are permitted provided that the following conditions are met:
universe@372 8 #
universe@372 9 # 1. Redistributions of source code must retain the above copyright
universe@372 10 # notice, this list of conditions and the following disclaimer.
universe@372 11 #
universe@372 12 # 2. Redistributions in binary form must reproduce the above copyright
universe@372 13 # notice, this list of conditions and the following disclaimer in the
universe@372 14 # documentation and/or other materials provided with the distribution.
universe@372 15 #
universe@372 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@372 17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@372 18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
universe@372 19 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
universe@372 20 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
universe@372 21 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
universe@372 22 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
universe@372 23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
universe@372 24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
universe@372 25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
universe@372 26 # POSSIBILITY OF SUCH DAMAGE.
universe@372 27 #
universe@372 28
universe@372 29 set(PANDOC_DESTDIR ${CMAKE_BINARY_DIR}/docs/web)
universe@372 30 set(PANDOC_ARGS -c ucx.css -B header.html -A footer.html -T 'UAP Common Extensions')
universe@372 31 set(PANDOC_SRC index.md license.md modules.md install.md)
universe@372 32 set(LOGO_PATH ../../uaplogo.png)
universe@372 33
universe@372 34 if (NOT EXISTS ${PANDOC_EXECUTABLE})
universe@372 35 find_program(PANDOC_EXECUTABLE pandoc)
universe@372 36 if(NOT EXISTS ${PANDOC_EXECUTABLE})
universe@372 37 message(WARNING Pandoc not found, docs-html target will not be generated.)
universe@372 38 return()
universe@372 39 endif()
universe@372 40 endif()
universe@372 41
universe@372 42 message(STATUS "HTML Documentation will be generated at: ${PANDOC_DESTDIR}.")
universe@372 43 file(MAKE_DIRECTORY ${PANDOC_DESTDIR})
universe@372 44
universe@372 45 foreach(source_file ${PANDOC_SRC})
universe@372 46 string(REPLACE .md .html dest_file ${source_file})
universe@372 47 string(PREPEND dest_file "${PANDOC_DESTDIR}/")
universe@372 48 list(APPEND PANDOC_DEST ${dest_file})
universe@372 49 add_custom_command(
universe@372 50 OUTPUT ${dest_file}
universe@372 51 COMMAND ${PANDOC_EXECUTABLE} ${PANDOC_ARGS} -o ${dest_file} ${source_file}
universe@372 52 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
universe@372 53 MAIN_DEPENDENCY ${source_file}
universe@372 54 )
universe@372 55 endforeach()
universe@372 56
universe@372 57 add_custom_target(docs-html
universe@372 58 COMMAND ${CMAKE_COMMAND} -E copy ucx.css ${PANDOC_DESTDIR}/ucx.css
universe@372 59 COMMAND ${CMAKE_COMMAND} -E copy ${LOGO_PATH} ${PANDOC_DESTDIR}/uaplogo.png
universe@372 60 DEPENDS ${PANDOC_DEST}
universe@372 61 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
universe@372 62 COMMENT "Generating HTML documentation with pandoc."
universe@372 63 )

mercurial