summaryrefslogtreecommitdiffstats
path: root/Utilities/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/CMakeLists.txt')
-rw-r--r--Utilities/CMakeLists.txt23
1 files changed, 22 insertions, 1 deletions
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 410f37a..8b3e325 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -11,4 +11,25 @@
#=============================================================================
subdirs(Doxygen KWStyle)
-add_subdirectory(Sphinx)
+if(CMAKE_DOC_TARBALL)
+ # Undocumented option to extract and install pre-built documentation.
+ # This is intended for use during packaging of CMake itself.
+ if(CMAKE_DOC_TARBALL MATCHES "/([^/]+)\\.tar\\.gz$")
+ set(dir "${CMAKE_MATCH_1}")
+ else()
+ message(FATAL_ERROR "CMAKE_DOC_TARBALL must end in .tar.gz")
+ endif()
+ add_custom_command(
+ OUTPUT ${dir}.stamp
+ COMMAND cmake -E remove_directory ${dir}
+ COMMAND cmake -E tar xf ${CMAKE_DOC_TARBALL}
+ COMMAND cmake -E touch ${dir}.stamp
+ DEPENDS ${CMAKE_DOC_TARBALL}
+ )
+ add_custom_target(documentation ALL DEPENDS ${dir}.stamp)
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dir}/
+ DESTINATION . USE_SOURCE_PERMISSIONS)
+else()
+ # Normal documentation build.
+ add_subdirectory(Sphinx)
+endif()