summaryrefslogtreecommitdiff
path: root/docs/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/CMakeLists.txt')
-rw-r--r--docs/CMakeLists.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
new file mode 100644
index 00000000..14126cfd
--- /dev/null
+++ b/docs/CMakeLists.txt
@@ -0,0 +1,40 @@
1# cmake should not fail if sphinx is missing
2find_package(Sphinx)
3
4if(SPHINX_EXECUTABLE)
5
6 if(NOT DEFINED SPHINX_THEME)
7 set(SPHINX_THEME default)
8 endif()
9
10 if(NOT DEFINED SPHINX_THEME_DIR)
11 set(SPHINX_THEME_DIR)
12 endif()
13
14 # configured documentation tools and intermediate build results
15 set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build")
16
17 # Sphinx cache with pickled ReST documents
18 set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
19
20 # HTML output directory
21 set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
22
23 configure_file(
24 "${CMAKE_CURRENT_SOURCE_DIR}/conf.py"
25 "${BINARY_BUILD_DIR}/conf.py"
26 @ONLY)
27
28 add_custom_target(docs
29 ${SPHINX_EXECUTABLE}
30 -b html
31 -c "${BINARY_BUILD_DIR}"
32 "${CMAKE_CURRENT_SOURCE_DIR}"
33 "${SPHINX_HTML_DIR}"
34 COMMENT "Building HTML documentation with Sphinx")
35else()
36 add_custom_target(docs
37 echo
38 "Please install python-sphinx to build the docs or read the docs online: https://projecttox.readthedocs.org/en/latest"
39 COMMENT "No sphinx executebale found")
40endif()