Allow users to override the documentation install directory.

This is needed for multiarch layouts where the prefix is /usr/${host}
but where arch-independent files are installed to /usr/share.

Change-Id: Icec01f8ea927594b4edb26997d6384e478415999
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b7e841..bfeeaa3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -686,6 +686,9 @@
 add_subdirectory(internal/ceres)
 
 if (BUILD_DOCUMENTATION)
+  set(CERES_DOCS_INSTALL_DIR "share/doc/ceres" CACHE STRING
+      "Ceres docs install path relative to CMAKE_INSTALL_PREFIX")
+
   find_package(Sphinx QUIET)
   if (NOT SPHINX_FOUND)
     message("-- Failed to find Sphinx, disabling build of documentation.")
diff --git a/docs/source/CMakeLists.txt b/docs/source/CMakeLists.txt
index dd3ddcb..0f07a5b 100644
--- a/docs/source/CMakeLists.txt
+++ b/docs/source/CMakeLists.txt
@@ -5,7 +5,7 @@
 
 # Install documentation
 install(DIRECTORY ${SPHINX_HTML_DIR}
-        DESTINATION share/doc/ceres
+        DESTINATION "${CERES_DOCS_INSTALL_DIR}"
         COMPONENT Doc
         PATTERN "${SPHINX_HTML_DIR}/*")