forked from vgvassilev/clad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateSphinxTarget.cmake
28 lines (22 loc) · 1.04 KB
/
CreateSphinxTarget.cmake
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
# Implementation of 'create_sphinx_target' in this file is copied from
# llvm implementation of 'AddSphinxTarget'.
# https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/AddSphinxTarget.cmake
find_package(Sphinx REQUIRED)
function(create_sphinx_target)
cmake_parse_arguments(SPHINX
"" # options
"SOURCE_DIR;TARGET_NAME"
"" # multi-value keywords
${ARGN}
)
set(SPHINX_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build)
set(SPHINX_DOC_TREE_DIR ${CMAKE_CURRENT_BINARY_DIR}/_doctrees)
add_custom_target(${SPHINX_TARGET_NAME}
COMMAND
${SPHINX_EXECUTABLE} -W --keep-going -b html -d ${SPHINX_DOC_TREE_DIR} ${SPHINX_SOURCE_DIR} ${SPHINX_BUILD_DIR}
COMMENT
"Generating sphinx user documentation into \"${SPHINX_BUILD_DIR}\""
VERBATIM
)
message(STATUS "Added ${SPHINX_TARGET_NAME} target")
endfunction()