Document cuDSS discovery and add WITH_CUDSS option

Document how to specify cudss_ROOT, CMAKE_PREFIX_PATH, or cudss_DIR when
cuDSS is installed in a CUDA-versioned directory (such as Ubuntu's
default /usr/lib/x86_64-linux-gnu/libcudss/12) or from a redistributable
archive, and honor the documented WITH_CUDSS CMake option.

Fixes https://github.com/ceres-solver/ceres-solver/issues/1151

Change-Id: I48d0ea36976f677fc189dfd3fe7a2a259676e069
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48ce3eb..8a0b6fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,6 +122,8 @@
   IOS OFF)
 set(WITH_CUDA "default" CACHE STRING
   "Enable use of CUDA linear algebra solvers.")
+cmake_dependent_option(WITH_CUDSS "Enable cuDSS support." ON
+  "WITH_CUDA" OFF)
 option(WITH_CUSTOM_BLAS
   "Use handcoded BLAS routines (usually faster) instead of Eigen." ON)
 cmake_dependent_option(WITH_EIGENMETIS "Enable Eigen METIS support." ON
@@ -333,7 +335,7 @@
 endif()
 
 set(_Ceres_FEATURE_CUDSS OFF)
-if (_Ceres_FEATURE_CUDA AND cudss_FOUND)
+if (_Ceres_FEATURE_CUDA AND WITH_CUDSS AND cudss_FOUND)
   set(_Ceres_FEATURE_CUDSS ON)
 endif()
 
diff --git a/docs/source/installation.rst b/docs/source/installation.rst
index 44ef910..0baa3a2 100644
--- a/docs/source/installation.rst
+++ b/docs/source/installation.rst
@@ -107,7 +107,14 @@
   Additionally, if ``cuDSS`` is also available (controlled by
   ``WITH_CUDSS``), then GPU acceleration can be used for
   ``SPARSE_NORMAL_CHOLESKY`` and ``SPARSE_SCHUR`` via the
-  ``CUDA_SPARSE`` sparse linear algebra library.
+  ``CUDA_SPARSE`` sparse linear algebra library. Because ``cuDSS`` is
+  commonly installed into a CUDA-versioned directory outside CMake's
+  default search paths (for example,
+  ``/usr/lib/x86_64-linux-gnu/libcudss/12`` when installed via ``apt`` on
+  Ubuntu) or extracted from a redistributable archive, pass its prefix via
+  ``cudss_ROOT`` or ``CMAKE_PREFIX_PATH`` (e.g.,
+  ``-Dcudss_ROOT=/usr/lib/x86_64-linux-gnu/libcudss/12``) or set
+  ``cudss_DIR`` to the directory containing ``cudss-config.cmake``.
 
 .. _section-source:
 
@@ -731,6 +738,7 @@
      to search (e.g., ``-DCMAKE_PREFIX_PATH="/opt/local;/custom/prefix"``).
    - ``<PackageName>_ROOT``: The installation prefix for a specific package
      (e.g., ``-DEigen3_ROOT=/path/to/eigen``, ``-Dabsl_ROOT=/path/to/abseil``,
+     ``-Dcudss_ROOT=/usr/lib/x86_64-linux-gnu/libcudss/12``,
      ``-DTBB_ROOT=/path/to/tbb``).
    - ``<PackageName>_DIR``: The exact directory containing the package's
      ``<PackageName>Config.cmake`` file (e.g., ``-DEigen3_DIR=...``,