summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--docs/CMakeLists.txt30
2 files changed, 31 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf3c601..b39a6fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,7 @@ endif ()
#}}}
#{{{ Subdirectories
+add_subdirectory(docs)
add_subdirectory(deps)
add_subdirectory(src)
#}}}
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
new file mode 100644
index 0000000..1ccfca0
--- /dev/null
+++ b/docs/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 2.6)
+
+find_program(SPHINX sphinx-build PATHS /usr/local/bin /usr/bin)
+mark_as_advanced(SPHINX)
+
+# --- End-user manual ---------------------------------------------------------
+if(SPHINX)
+ option(WITH_MANUAL "Build user manual" ON)
+
+ if (WITH_MANUAL)
+ set(input_dir ${CMAKE_CURRENT_SOURCE_DIR})
+ set(output_dir ${CMAKE_CURRENT_BINARY_DIR}/manual/html)
+
+ file(GLOB_RECURSE sphinx_source ${input_dir}/*.rst)
+
+ foreach(file ${sphinx_static})
+ configure_file(${input_dir}/${file} ${output_dir}/${file} COPYONLY)
+ endforeach()
+
+ add_custom_command(OUTPUT ${output_dir}/index.html
+ COMMAND ${SPHINX} -b html ${input_dir} ${output_dir}
+ DEPENDS ${sphinx_source}
+ COMMENT "Build Sphinx HTML")
+
+ add_custom_target(manual ALL DEPENDS ${output_dir}/index.html)
+
+ add_dependencies(manual ufo)
+ endif()
+endif()
+