Squashed 'third_party/ceres/' changes from 399cda773..7f9cc571b

7f9cc571b Set CMAKE_CUDA_ARCHITECTURES depending on CUDAToolkit_VERSION
6a74af202 Remove a level of indirection when using CellInfo
f8c2994da Drop Ubuntu 20.04 and add Ubuntu 24.04 support
20954e693 Eliminate CUDA set but unused variable warning
57aba3ed0 Enable Apple linker library deduplication
1f15197be Drop macos-11 runner and support macos-14 instead
5de0fda0f Update Github actions
308a5bb43 Add missing include
715865101 Remove 32-bit MinGW from CI matrix
f71181a92 Remove remaining references to CXSparse
522210a08 Reuse macro to format version string
cd2dd06e9 Fix clang16 compiler warnings
1f2e6313a Add missing std qualifiers
125c06882 Link static cuda libs when ceres is build static
62c03d6ff Revert "Update Eigen::BDCSVD usage to comply with Eigen 3.4"
4027f6997 Update Eigen::BDCSVD usage to comply with Eigen 3.4
1b2ebabf5 Typo fixes in the documentation
2ffeb943a Fix typo in AutoDiffManifold comment and docs
da34da3da Remove CreateFakeBundleAdjustmentPartitionedJacobian
85b2c418a ClangTidy fixes
91773746b Simplify instantiation of cost functions and their functors
8b88a9ab4 Use C++17 Bessel functions
84436f791 Use native CMake TBB package configuration
556a56f21 Do not assume Homebrew usage
3fd2a72cc MinGW no longer provides a 32-bit METIS package
e776a6f1a Unbreak the Bazel build.
095d48392 Skip structure detection on preprocessor failure
a0876309a Fix typos in comments
774973731 Fix search on ceres-solver.org
85331393d Update docs for 2.2.0.
2120eae67 Optimize the computation of the LM diagonal in TinySolver
611b139b1 Fix Solver::Options::callbacks type in documentation
b652d3b4f Unbreak the windows build
b79c4d350 ClangTidy fixes
76af132d0 Update docs for 2.2.0RC3
dc7a85975 Single-threaded operations on small vectors
b379ab768 Remove MaxNumThreadsAvailable
354002f98 Schedule task in ParallerFor from the previous task
a9b3fcff4 Minor update to docs
5ccab18be Drop use of POSIX M_PI_2 and M_PI_4
4519b8d77 Drop use of POSIX M_PI
b83abdcb1 Add a default value for Solver::Summary::linear_solver_ordering_type
8d875a312 Fix checks for CUDA memory pools support
94335e3b9 More ClangTidy fixes
399395c4f Miscellaneous ClangTidy fixes
c8bed4b93 Update version_history for 2.2.0rc2
489339219 Rework MSVC warning suppression
0cea191d4 Move stream-ordered memory allocations
8e3b7d89e Fix a copy-pasta error
dc0bb8508 Various cleanups to the documentation
4588b0fbb Add an example for EvaluationCallback
0fc3fd4fc Add documentation for examples
e6b2f532b Parallelize PSE preconditioner
41672dff8 Add end-to-end BA tests for SCHUR_POWER_SERIES_EXPANSION
83ee376d8 Add an example for IterationCallback
371265094 Cleanup example code
59182a42c Update documentation
d4db6e6fe Fix typos in the documentation for EvaluationCallback
dffd8cd71 Add an accessor for the CostFunctor in DynamicAutoDiffCostFunction
bea247701 Add a missing include dir to the cuda kernels target.
18ea7d1c2 Runtime check for cudaMallocAsync support
a227045be Remove cuda-memcheck based tests
d10e786ca Remove an unused variable from CudaSparseMatrix
5a30cae58 Preparing for 2.2.0rc1
9cca67127 Enable compatibility with SuiteSparse 7.2.0
a1c02e8d3 Rework the Sphinx find module
a57e35bba Require at least CMake 3.16
863db948f Eliminate macOS sprintf warning
6f5342db6 Export ceres_cuda_kernels to project's build tree
d864d146f Add macOS 13 runner to Github workflows
01a23504d Add a workaround for CMake Policy CMP0148
de9cbde95 Work around MinGW32 manifold_test segfault
5e4b22f7f Update CudaSparseMatrix class
ed9921fc2 Fix Solver::Options in documentation
de62bf220 Two minor fixes
5f97455be Fix typos in documentation
5ba62abec Add CUDA support to windows CI builds
a98fdf582 Update CMakeLists.txt to fix Windows CUDA build
ec4907399 Fix block-sparse to crs conversion on windows
799ee91bb Fix check in CompressedRowJacobianWriter::CreateJacobian()
ee90f6cbf Detect large Jacobians and return failure instead of crashing.
310a252fb Deal with infinite initial cost correctly.
357482db7 Add NumTraits::max_digits10 for Jets
908b5b1b5 Fix type mismatch in documentation
75bacedf7 CUDA partitioned matrix view
fd6197ce0 Fixed GCC 13.1 compilation errors
df97a8f05 Improve support of older CUDA toolkit versions
085214ea7 Fix test CompressedRowSparseMatrix.Transpose
d880df09f Match new[] with delete[] in BSM
bdee4d617 Block-sparse to CRS conversion using block-structure
0f9de3daf Use page locked memory in BlockSparseMatrix
e7bd72d41 Permutation-based conversion from block-sparse to crs
abbc4e797 Explicitly compute number of non-zeros in row
96fdfd2e7 Implement tests for Euler conversion with jets
db1ebd3ff Work around lack of constexpr constructors for Jet
16a4fa04e Further Jet conversion fixes
92ad18b8a Fix a Jet conversion bug in rotation.h
a5e745d4e ClangTidy fixes
77ad8bb4e Change storage in BlockRandomAccessSparseMatrix
d340f81bd Clang Tidy fixes
54ad3dd03 Reorganize ParallelFor source files
ba360ab07 Change the value of BlockRandomAccessSparseMatrix::kMaxRowBlocks
0315c6ca9 Provide DynamicAutoDiffCostFunction deduction guide
3cdfae110 Replace Hertzberg mentions with citations
0af38a9fc Fix typos in documentation
4c969a6c1 Improve image of loss functions shape
b54f05b8e Add missing TukeyLoss to documentation
8bf4a2f42 Inexact check for ParallelAssign test
9cddce73a Explicit conversions from long to int in benchmarks (for num_threads)
5e787ab70 Using const ints in jacobian writers
f9bffbb6f Removing -Wshorten-64-to-32 warnings from examples (part 1)
e269b64f5 More ClangTidy fixes
f4eb768e0 Using int64 in file.cc. Fixing compilation error in array_utils.cc
74a0f0d24 Using int64_t for sizes and indexes in array utils
749a442d9 Clang-Tidy fixes
c4ba975ae Fix rotation_test.cc to work with older versions of Eigen
9602ed7b7 ClangFormat changes
79a554ffc Fix a bug in QuaternionRotatePoint.
f1113c08a Commenting unused parameters for better readibility
772d927e1 Replacing old style typedefs with new style usings
53df5ddcf Removing using std::...
e1ca3302a Increasing bazel timeout for heavy BA tests
f982d3071 Fixing bazel build
cb6b30662 Use hypot to compute the L^2 norm
1e2a24a8b Update Github actions to avoid deprecation warnings
285e5f9f4 Do not update brew formulae upon install
73d95b03f Clang-Tidy fixes
51d52c3ea Correct epsilon in CUDA QR test changed by last commit.
546f5337b Updates to CUDA dense linear algebra tests
19ab2c179 BlockRandomAccessMatrix Refactor
a3a062d72 Add a missing header
2b88bedb2 Remove unused variables
9beea728f Fix a bug in CoordinateDescentMinimizer
8e5d83f07 ClangFormat and ClangTidy changes
b15851508 Parallel operations on vectors
2fd81de12 Add build configuration with CUDA on Linux
06bfe6ffa Remove OpenMP and No threading backends.
352b320ab Fixed SuiteSparse 6.0 version parsing
8fd7828e3 ClangTidy fixes
0424615dc Fix PartitionedMatrixView usage in evaluation_benchmark
77a54dd3d Parallel updates to block-diagonal EtE FtF
946fa50de ClangTidy fixes
e4bef9505 Refactor PartitionedMatrixView to cache the partitions
d3201798e Clean up sparse_cholesky_test
addcd342f ClangTidy fixes
c2e7002d2 Remove an unused variable from evaluation_benchmark.cc
fef6d5875 Parallel left products for PartitionedMatrixView
37a3cb384 Update SuiteSparse in MSVC Github workflow
5d53d1ee3 Parallel for with iteration costs and left product
9aa52c6ff Use FindCUDAToolkit for CMake >= 3.17
47e03a6d8 Add const accessor for Problem::Options used by Problem
d6a931009 Clang Tidy Fixes
9364e31ee Fix a regression in SuiteSparse::AnalyzeCholesky
89b3e1f88 Remove unused includes of gflags and gtest
984079003 Fix missing regex dependency for gtest on QNX
6b296f27f Fix missing namespace qualification and docs for Manifold gtest macro
6685e629f AddBlockStructureTranspose to BlockSparseMatrix
699e3f3b3 Fix a link error in evaluation_benchmark.cc
19a3d07f9 Add multiplication benchmarks on BAL data
b221b1294 Format code with clang-format.
ccf32d70c Purge all remaining references to (defunct) LocalParameterization
5f8c406e2 struct ContextImpl -> class ContextImpl
9893c534c Several cleanups.
a78a57472 ClangTidy fixes
b1fe60330 Parallel right products for partitioned view
16668eedf Fix a memory leak in ContextImpl
d129938d5 Third time is the charm
4129b214a More fixes to cuda_dense_cholesky_test.cc
5c01d2573 Remove unused variables from cuda_dense_cholesky_test.cc
5e877ae69 Fix the Bazel build
d89290ffa Fix evalution_benchmark compilability
ae7f456e3 ClangTidy fixes
9438c370f Restore the semantics of TrustRegionMinimizer
c964fce90 Fix bug in cuda_kernels_test
afaad5678 Fix a typo
b7116824b Evaluation benchmark
2b89ce66f Add generalized Euler Angle conversions
8230edc6c ClangTidy fixes
9a2894763 Speed up locking when num_threads = 1.
739f2a25a Parallelize block_jacobi_preconditioner
c0c4f9394 Change implementation of parallel for
fc826c578 CUDA Cleanup
660af905f Fix a bug in TrustRegionMinimizer.
4cd257cf4 Let NumericDiffFirstOrderFunction take a dynamically sized parameter vector
6c27ac6d5 Fix repeated SpMV Benchmark
430a292ac Add a missing include
858b4b89b More ClangTidy fixes
e9e995740 ClangTidy fixes
7f8e930a0 Fix lint errors
f86a3bdbe Unify Block handling across matrix types
5f1946879 clang-formated source
00a05cf70 CUDA SDK Version-based SpMV Selection
de0f74e40 Optimize  the BlockCRSJacobiPreconditioner
ba65ddd31 Improvements to benchmarks
42352e2e2 Added CUDA Jacobi Preconditioner
f802a09ff &foo[0] -> foo.data()
344929647 Add CUDA GPU and Runtime Detection
6085e45be Minor CUDA cleanup.
e15ec89f3 Speed up bundle_adjuster
058a72782 One more ClangTidy fix.
f6f2f0d16 ClangTidy cleanups Also some clang-format cleanups.
9d74c6913 Fix some more errant CATD warnings
a4f744095 Remove an unused variable from compressed_row_sparse_matrix.cc
388c14286 Fix GCC 12.1.1 LTO -Walloc-size-larger-than= warnings
9ec4f7e44 Refactor BlockJacobiPreconditioner
adda97acd Fixed a few more missing CERES_NO_CUDA guards
22aeb3584 Fix a missing string assignment in solver.cc
3b891f767 Insert missing CUDA guards.
829089053 CUDA CGNR, Part 4: CudaCgnrSolver
6ab435d77 Fix a missing CERES_NO_CUDA guard
c560bc2be CUDA CGNR, Part 3: CudaSparseMatrix
c914c7a2b CUDA CGNR, Part 2: CudaVector
3af3dee18 Simplify the implementation to convert from BlockSparseMatrix to CompressedRowSparseMatrix.
242fc0795 Remove unnecessary destructors
737200ac8 Add macos-12 to Github workflow runners
9c968d406 Silence Clang warning
2c78c5f33 Small naming fixups.
2a25d86b0 Integrate schur power series expansion options to bundle adjuster
4642e4b0c Use if constexpr and map SparseMatrix as const
92d837953 Enable usage of schur power series expansion preconditioner.
f1dfac8cd Reduce the number of individual PRNG instances
79e403b15 Expand vcpkg installation instructions
7b0bb0e3f ClangTidy cleanups
c5c2afcc9 Fix solver_test.cc for preconditioners and sparse linear algebra libraries
07d333fb6 Refactor options checking for linear solvers
ba7207b0b A number of small changes.
20e85bbe3 Add power series expansion preconditioner
04899645c LinearOperator::FooMultiply -> LinearOperator::FooMultiplyAndAccumulate
288a3fde6 Add missing virtual destructors to matrix adapters
6483a2b4c Add Sergiu's name to the list of maintainers
1cf49d688 Update FindGlog.cmake to create glog::glog target
1da72ac39 Refactor ConjugateGradientsSolver
f62dccdb3 Fix the Sphere and Line Manifold formulations
3e1cc89f6 A bunch of clang-tidy fixes.
80380538a One more CATD fix
560ef46fb A bunch of minor fixes.
67bae28c1 CUDA CGNR, Part 1: Misc. CLeanup
5d0bca14d Remove ceres/internal/random.h in favor of <random>
d881b5ccf Minor fixes in comments
37516c968 Fix a bug in InnerProductComputer.
d8dad14ee CUDA Cleanup
c9d2ec8a9 Updates to sparse block matrix structures to support new sparse linear solvers.
5fe0bd45a Added MinGW to Windows Github workflow
738c027c1 Fix a logic error in iterative_refiner_test
cb6ad463d Add mixed precision support for CPU based DenseCholesky
df55682ba Fix Eigen error in 2D sphere manifolds Since Eigen does not allow to have a RowMajor column vector (see https://gitlab.com/libeigen/eigen/-/issues/416), the storage order must be set to ColMajor in that case. This fix adds that special case when generating 2D sphere manifolds.
1cf59f61e Set Github workflow NDK path explicitly
68c53bb39 Remove ceres::LocalParameterization
2f660464c Fix build issue with CUDA testing targets when compiling without gflags.
c801192d4 Minor fixes
ce9e902b8 Fix missing CERES_METIS_VERSION
d9a3dfbf2 Add a missing ifdef guard to dense_cholesky_test
5bd43a1fa Speed up DenseSparseMatrix::SquareColumnNorm.
cbc86f651 Fix the build when CUDA is not present
5af8e6449 Update year in solver.h
88e08cfe7 Mixed-precision Iterative Refinement Cholesky With CUDA
290b34ef0 Fix optional SuiteSparse + METIS test-suite names to be unique
d038e2d83 Fix use of NESDIS with SuiteSparse in tests if METIS is not found
027e741a1 Eliminated MinGW warning
4e5ea292b Fixed MSVC 2022 warning
83f6e0853 Fix use of conditional preprocessor checks within a macro in tests
70f1aac31 Fix fmin/fmax() when using Jets with float as their scalar type
5de77f399 Fix reporting of METIS version
11e637667 Fix #ifdef guards around METIS usage in EigenSparse backend and tests
0c88301e6 Provide optional METIS support
f11c25626 Fix fmin/fmax() to use Jet averaging on equality
b90053f1a Revert C++17 usage of std::exclusive_scan
dfce1e128 Link against threading library only if necessary
69eddfb6d Use find module to link against OpenMP
b4803778c Update documentation for linear_solver_ordering_type
2e764df06 Update Cuda memcheck test
443ae9ce2 Update Cuda memcheck test
55b4c3f44 Retain terminal formatting when building docs
786866d9f Generate version string at compile time
5bd83c4ac Unbreak the build with EIGENSPARSE is disabled
2335b5b4b Remove support for CXSparse
fbc2eea16 Nested dissection for ACCELERATE_SPARSE & EIGEN_SPARSE
d87fd551b Fix Ubuntu 20.04 workflow tests
71717f37c Use glog 0.6 release to run Windows Github workflow
66e0adfa7 Fix detection of sphinx-rtd-theme
d09f7e9d5 Enable postordering when computing the sparse factorization.
9b34ecef1 Unbreak the build on MacOS
8ba8fbb17 Remove Solver::Options::use_postordering
30b4d5df3 Fix the ceres.bzl to add missing cc files.
39ec5e8f9 Add Nested Dissection based fill reducing ordering
aa62dd86a Fix a build breakage
41c5fb1e8 Refactor suitesparse.h/cc
12263e283 Make the min. required version of SuiteSparse to be 4.5.6
c8493fc36 Convert internal enums to be class enums.
bb3a40c09 Add Nested Dissection ordering method to SuiteSparse
f1414cb5b Correct spelling in comments and docs.
fd2b0ceed Correct spelling (contiguous, BANS)
464abc198 Run Linux Github workflow on Ubuntu 22.04
caf614a6c Modernize code using c++17 constructs
be618133e Simplify some template metaprograms using fold expressions.
3b0096c1b Add the ability to specify the pivot threshold in Covariance::Options
40c1a7e18 Fix Github workflows
127474360 Ceres Solver now requires C++17
b5f1b7877 clang-format cleanup
32cd1115c Make the code in small_blas_generic.h more compiler friendly.
f68321e7d Update version history
b34280207 Fix MSVC small_blas_test failures
b246991b6 Update the citation instructions in the docs
c0c14abca Fix version history item numbering
d23dbac25 Update Windows install guide
e669c9fc7 Provide citation file
ff57c2e91 Update version history for 2.1.0rc2
ab9436cb9 Workaround MSVC STL deficiency in C++17 mode
97c232857 Update the included gtest to version 1.11.0
4eac7ddd2 Fix Jet lerp test regression
2ffbe126d Fix Jet test failures on ARMv8 with recent Xcode
0d6a0292c Fix unused arguments of Make1stOrderPerturbation
93511bfdc Fix SuiteSparse path and version reporting
bf329b30f Fix link to macOS badge
0133dada2 Add Github workflows
3d3d6ed71 Add missing includes
0a9c0df8a Fix path for cuda-memcheck tests
ee35ef66f ClangFormat cleanup via scripts/all_format.sh
470515985 Add missing includes for config.h
d3612c12c Set CMP0057 policy for IN_LIST operator in FindSuiteSparse.cmake
4bc100c13 Do not define unusable import targets
e91995cce Fix Ubuntu 18.04 shared library build
94af09186 Force C++ linker
a65e73885 Update installation docs
1a377d707 Fix Ubuntu 20.04 SPQR build
817f5a068 Switch to imported SuiteSparse, CXSparse, and METIS targets
b0f32a20d Hide remaining internal symbols
572395098 Add a missing include
b0aef211d Allow to store pointers in ProductManifold
9afe8cc45 Small compile fix to context_impl
284be88ca Allow ProductManifold default construction
f59059fff Bugfix to CUDA workspace handling
779634164 Fix MSVC linker error
7743d2e73 Store ProductManifold instances in a tuple
9f32c42ba Update Travis-CI status badge to .com from .org
eadfead69 Move LineManifold and SphereManifold into their own headers.
f0f8f93bb Fix docs inconsistencies
e40391efa Update version history in preparation for 2.1.0
6a37fbf9b Add static/compile time sizing to EuclideanManifold
4ad787ce1 Fix the bazel build
ae4d95df6 Two small clang-tidy fixes
f0851667b Fix MSVC compilation errors
c8658c899 Modernize more
46b3495a4 Standardize path handling using GNUInstallDirs
98bc3ca17 Fix shared library build due to missing compile features specification
8fe8ebc3a Add final specifier to public classes
84e1696f4 Add final specifier to internal classes.
518970f81 Context should be exported
09ec4997f Cleanup examples
90e58e10f Add missing #include.
15348abe9 Add CUDA based bundle adjustment tests.
57ec9dc92 Do not enforce a specific C++ standard
99698f053 Fix Apple Clang weak symbols warnings
8e0842162 Add support for dense CUDA solvers #3
aff51c907 Revert "Do not enforce a specific C++ standard"
527c3f7da Fixed gflags dependency
d839b7792 Do not enforce a specific C++ standard
f71167c62 Fixed missing include in minilog build
47502b833 Miscellaneous CUDA related changes.
bb2996681 Check CUDA is available in solver.cc
7d2e4152e Add support for dense CUDA solvers #2
f90833f5f Simplify symbol export
c6158e0ab Replace NULL by nullptr
7e4f5a51b Remove blas.h/cc as they are not used anymore.
e0fef6ef0 Add cmake option ENABLE_BITCODE for iOS builds
446487c54 Add <memory> header to all files using std::unique_ptr.
9c5f29d46 Use compiler attributes instead of [[deprecated]]
44039af2c Convert factory functions to return std::unique_ptrs.
708a2a723 Silence LocalParameterization deprecation warnings
de69e657a Fix another missing declaration warning
677711138 Fix segmentation fault in AVX2 builds
0141ca090 Deprecate LocalParameterizations
fdfa5184a Fix missing declaration warning
4742bf386 Add LineManifold.
c14f360e6 Drop trivial special members
ae65219e0 ClangTidy cleanups
a35bd1bf9 Use = default for trivial special members
db67e621e Fix dense_cholesky_test.cc comma handling.
484d3414e Replace virtual keyword by override
2092a720e Fix some nits.
36d6d8690 Add support for dense CUDA solvers #1
af5e48c71 Add SphereManifold.
182cb01c5 Normalize Jet classification and comparison
9dbd28989 Loosen tolerances in dense_qr_test.cc
cab853fd5 Add DenseQR Interface
8ae054ad9 Fix missing declaration warning in autodiff_manifold_test
408af7b1a Move the constructor and destructor for SchurComplementSolver
d51672d1c Move the constructor and destructor for DenseSchurComplementSolver
177b2f99d Use benchmark version 1.6 compatible syntax.
ce9669003 Add const accessor for functor wrapped by auto/numeric-diff objects
9367ec9cc Add a benchmark for dense linear solvers.
7d6524daf Support fma Jet
a0d81ad63 Fix a bug in AutoDiffManifold
5a99e42e1 ClangTidy fixes
40fb41355 Update .gitignore
e6e6ae087 Unbreak the bazel build
0572efc57 Fix a compilation warning in autodiff_manifold.h
475db73d0 Fix build breakage when LAPACK support is disabled.
095c9197f Fix iterative_refiner_test.cc
6d06e9b98 Add DenseCholesky
77c0c4d09 Migrate examples to use Manifolds
19eef54fc Rename Quaternion to QuaternionManifold. Also rename EigenQuaternion to EigenQuaternionManiold.
ca6d841c2 Add AutoDiffManifold
97d7e0737 Move the manifold testing matchers to manifold_test_utils.h
16436b34b Fix some more clang-tidy suggestions.
dcdefc216 Fix a bunch of clang-tidy suggestions.
d8a1b69ab Remove an unused variable from gradient_checker.cc
611b46b54 Remove the use of CHECK_NOTNULL.
125a0e9be LocalParameterization -> Manifold #1
00bfbae11 Add missing algorithm header to manifold.cc
1d5aff059 Refactor jet_tests.cc
fbd693091 Fix two unused variable warnings.
c0cb42e5f Add Problem::HasParameterization
7e2f9d9d4 Add EigenQuaternion manifold and tests for it.
b81a8bbb7 Add the Quaternion manifold and tests.
4a01dcb88 Add more invariants and documentation to manifold_test.cc
bdd80fcce Improve Manifold testing
ce1537030 Fixed missing headers in manifold.h
23b204d7e LocalParameterization -> Manifold #1
c2fab6502 Fix docs of supported sparse backends for mixed_precision_solves option
8cb441c49 Fix missing declaration warnings in GCC
d2b7f337c Remove split.cc from the bazel sources.
206061a6b Use standard c++ types in jet_test.cc
1f374a9fe Support promotion in comparison between Jet and scalars
06e68dbc5 Avoid midpoint overflow in the differential
276d24c73 Fix C++20 compilation
b1391e062 Support midpoint Jet
8426526df Support lerp Jet
57c279689 support 3-argument hypot jet
123fba61c Eigen::MappedSparseMatrix -> Eigen::Map<Eigen::SparseMatrix>
3f950c66d reworked copysign tests
48cb54d1b fix fmin and fmax NaN handling
552a4e517 support log10 jet
4e49c5422 reuse expm1 result for differential
8d3e64dd5 Use modern-style Eigen3 CMake variables
2fba61434 support log1p and expm1 jet
a668cabbc support norm jet
a3a4b6d77 support copysign jet
b75dac169 fix abs jet test comment
034bf566f use copysign for abs jet
31008453f Add example for BiCubicInterpolator
7ef4a1221 Add a section on implicit and inverse function theorems
686428f5c Move the further reading section to bibliography
e47d87fdd Add a note about Trigg's correction
d2852518d Fix the docs for Problem::RemoveResidualBlock & Problem::RemoveParameterBlock
06e02a173 Delete unused files split.h/cc
ac7268da5 Fix an 80cols issue in covariance_impl.cc
17dccef91 Add NumericDiffFirstOrderFunction
03d64141a Fix a incorrect check in reorder_program.cc
884111913 Two changes to TinySolver
4dff3ea2c Fix a number of typos in rotation.h
98719ced4 Fix a type in interfacing_with_autodiff.html
0299ce944 Update conf.py to be compatible with Sphinx 4.1.2
2a2b9bd6f Fix a bug in covariance_impl.cc
27fade7b8 Fix a bug in system_test.cc
d4eb83ee5 Fix the Jacobian in trust_region_minimizer_test.cc
5f6071a1c Fix a bug in local_parameterization_test.cc
b2e732b1e Fix errors in comments from William Gandler.
42f1d6717 Add accessors to GradientProblem
aefd37b18 Refactor small_blas_gemm_benchmark
dc20db303 [docs] Fix `IterationSummary` section. Add missing `IterationCallback`
90ba7d1ef [docs] Fix typos
c3129c3d4 Fix tests not executing
7de561e8e Fix dependency check for building documentation
4fbe218f2 Refactor small_blas_test
3fdde8ede Remove an errant double link.
20ad431f7 Fixing a typo in the version history
0c85c4092 Revert "Reduce copies involved in Jet operations"
3a02d5aaf Fix typo in LossFunctionWrapper sample code
7b2c223be Add fmax/fmin overloads for scalars
c036c7819 Reduce copies involved in Jet operations
51945e061 Introduce benchmark for Jet operations
ec4f2995b Do not check MaxNumThreadsAvailable if the thread number is set to 1.
98f639f54 Add a macro CERES_GET_FLAG.
766f2cab5 Reduce log spam in covariance_impl.cc.
941ea1347 Fix FindTBB version detection with TBB >= 2021.1.1
323c350a6 fix Eigen3_VERSION
2b32b3212 Revert "Group specializations into groups of four"
313caf1ae Allow Unity build.
4ba244cdb Group specializations into groups of four
d77a8100a Make miniglog's InitGoogleLogging argument const.
863724994 Use portable expression for constant 2/sqrt(pi)
97873ea65 Add some missing includes for glog/logging.h
d15b1bcd3 Increase tolerance in small_blas_test.cc
17cf01831 Hide 'format not a string literal' error in examples
64029909b Fix -Wno-maybe-uninitialized error
21294123d Fix nonnull arg compared to NULL error.
1dd417410 Fix -Wno-format-nonliteral
6c106bf51 Fix -Wmissing-field-initializers error
c48a32792 Use cc_binary includes so examples build as external repo
e0e14a5cd Fix errors found by -Werror
e84cf10e1 Fix an errant double in TinySolver.
66b4c33e8 updated unit quaternion rotation
d45ec47b5 Fix a typo in schur_eliminator.h

Change-Id: I60db062e44d051d50dbb3a145eec2f74d5190481
git-subtree-dir: third_party/ceres
git-subtree-split: 7f9cc571b03632f1df93ea35725a1f5dfffe2c72
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/cmake/AddCompileFlagsIfSupported.cmake b/cmake/AddCompileFlagsIfSupported.cmake
index 1af9ee8..d947fdf 100644
--- a/cmake/AddCompileFlagsIfSupported.cmake
+++ b/cmake/AddCompileFlagsIfSupported.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2017 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/AddGerritCommitHook.cmake b/cmake/AddGerritCommitHook.cmake
index 65b2fab..070158c 100644
--- a/cmake/AddGerritCommitHook.cmake
+++ b/cmake/AddGerritCommitHook.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/AppendTargetProperty.cmake b/cmake/AppendTargetProperty.cmake
deleted file mode 100644
index e0bc3a4..0000000
--- a/cmake/AppendTargetProperty.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-# Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
-# http://ceres-solver.org/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors may be
-#   used to endorse or promote products derived from this software without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# Author: alexs.mac@gmail.com (Alex Stewart)
-
-# Append item(s) to a property on a declared CMake target:
-#
-#    append_target_property(target property item_to_append1
-#                                           [... item_to_appendN])
-#
-# The set_target_properties() CMake function will overwrite the contents of the
-# specified target property.  This function instead appends to it, so can
-# be called multiple times with the same target & property to iteratively
-# populate it.
-function(append_target_property TARGET PROPERTY)
-  if (NOT TARGET ${TARGET})
-    message(FATAL_ERROR "Invalid target: ${TARGET} cannot append: ${ARGN} "
-      "to property: ${PROPERTY}")
-  endif()
-  if (NOT PROPERTY)
-    message(FATAL_ERROR "Invalid property to update for target: ${TARGET}")
-  endif()
-  # Get the initial state of the specified property for the target s/t
-  # we can append to it (not overwrite it).
-  get_target_property(INITIAL_PROPERTY_STATE ${TARGET} ${PROPERTY})
-  if (NOT INITIAL_PROPERTY_STATE)
-    # Ensure that if the state is unset, we do not insert the XXX-NOTFOUND
-    # returned by CMake into the property.
-    set(INITIAL_PROPERTY_STATE "")
-  endif()
-  # Delistify (remove ; separators) the potentially set of items to append
-  # to the specified target property.
-  string(REPLACE ";" " " ITEMS_TO_APPEND "${ARGN}")
-  set_target_properties(${TARGET} PROPERTIES ${PROPERTY}
-    "${INITIAL_PROPERTY_STATE} ${ITEMS_TO_APPEND}")
-endfunction()
diff --git a/cmake/CeresCompileOptionsToComponents.cmake b/cmake/CeresCompileOptionsToComponents.cmake
index 5be0fb2..64634d5 100644
--- a/cmake/CeresCompileOptionsToComponents.cmake
+++ b/cmake/CeresCompileOptionsToComponents.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2016 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
@@ -77,15 +77,9 @@
   add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
     CERES_NO_SUITESPARSE "SuiteSparse;SparseLinearAlgebraLibrary")
   add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
-    CERES_NO_CXSPARSE "CXSparse;SparseLinearAlgebraLibrary")
-  add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
     CERES_NO_ACCELERATE_SPARSE "AccelerateSparse;SparseLinearAlgebraLibrary")
   add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
     CERES_RESTRICT_SCHUR_SPECIALIZATION "SchurSpecializations")
-  add_to_output_if_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
-    CERES_USE_OPENMP "OpenMP;Multithreading")
-  add_to_output_if_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
-    CERES_USE_CXX_THREADS "Multithreading")
   # Remove duplicates of SparseLinearAlgebraLibrary if multiple sparse backends
   # are present.
   list(REMOVE_DUPLICATES ${CERES_COMPONENTS_VAR})
diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in
index e5e2976..ceb7e26 100644
--- a/cmake/CeresConfig.cmake.in
+++ b/cmake/CeresConfig.cmake.in
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
+# Copyright 2022 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
@@ -173,10 +173,14 @@
 endif(CERES_WAS_INSTALLED)
 
 # Set the version.
-set(CERES_VERSION @CERES_VERSION@ )
+set(CERES_VERSION @CERES_VERSION@)
 
 include(CMakeFindDependencyMacro)
-find_dependency(Threads)
+# Optional dependencies
+@METIS_DEPENDENCY@
+@SuiteSparse_DEPENDENCY@
+@CUDAToolkit_DEPENDENCY@
+@Threads_DEPENDENCY@
 
 # As imported CMake targets are not re-exported when a dependent target is
 # exported, we must invoke find_package(XXX) here to reload the definition
@@ -187,30 +191,30 @@
 
 # Eigen.
 # Flag set during configuration and build of Ceres.
-set(CERES_EIGEN_VERSION @EIGEN3_VERSION_STRING@)
+set(CERES_EIGEN_VERSION @Eigen3_VERSION@)
 # Search quietly to control the timing of the error message if not found. The
 # search should be for an exact match, but for usability reasons do a soft
 # match and reject with an explanation below.
 find_package(Eigen3 ${CERES_EIGEN_VERSION} QUIET)
-if (EIGEN3_FOUND)
-  if (NOT EIGEN3_VERSION_STRING VERSION_EQUAL CERES_EIGEN_VERSION)
+if (Eigen3_FOUND)
+  if (NOT Eigen3_VERSION VERSION_EQUAL CERES_EIGEN_VERSION)
     # CMake's VERSION check in FIND_PACKAGE() will accept any version >= the
     # specified version. However, only version = is supported. Improve
     # usability by explaining why we don't accept non-exact version matching.
     ceres_report_not_found("Found Eigen dependency, but the version of Eigen "
-      "found (${EIGEN3_VERSION_STRING}) does not exactly match the version of Eigen "
+      "found (${Eigen3_VERSION}) does not exactly match the version of Eigen "
       "Ceres was compiled with (${CERES_EIGEN_VERSION}). This can cause subtle "
       "bugs by triggering violations of the One Definition Rule. See the "
       "Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule "
       "for more details")
   endif ()
   ceres_message(STATUS "Found required Ceres dependency: "
-    "Eigen version ${CERES_EIGEN_VERSION} in ${EIGEN3_INCLUDE_DIRS}")
-else (EIGEN3_FOUND)
+    "Eigen version ${CERES_EIGEN_VERSION} in ${Eigen3_DIR}")
+else (Eigen3_FOUND)
   ceres_report_not_found("Missing required Ceres "
     "dependency: Eigen version ${CERES_EIGEN_VERSION}, please set "
     "Eigen3_DIR.")
-endif (EIGEN3_FOUND)
+endif (Eigen3_FOUND)
 
 # glog (and maybe gflags).
 #
diff --git a/cmake/CeresThreadingModels.cmake b/cmake/CeresThreadingModels.cmake
deleted file mode 100644
index 571dd7d..0000000
--- a/cmake/CeresThreadingModels.cmake
+++ /dev/null
@@ -1,82 +0,0 @@
-# Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2018 Google Inc. All rights reserved.
-# http://ceres-solver.org/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors may be
-#   used to endorse or promote products derived from this software without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# Author: alexs.mac@gmail.com (Alex Stewart)
-
-# Ordered by expected preference.
-set(CERES_THREADING_MODELS "CXX_THREADS;OPENMP;NO_THREADS")
-
-function(find_available_ceres_threading_models CERES_THREADING_MODELS_AVAILABLE_VAR)
-  set(CERES_THREADING_MODELS_AVAILABLE ${CERES_THREADING_MODELS})
-  # Remove any threading models for which the dependencies are not available.
-  find_package(OpenMP QUIET)
-  if (NOT OPENMP_FOUND)
-    list(REMOVE_ITEM CERES_THREADING_MODELS_AVAILABLE "OPENMP")
-  endif()
-  if (NOT CERES_THREADING_MODELS_AVAILABLE)
-    # At least NO_THREADS should never be removed.  This check is purely
-    # protective against future threading model updates.
-    message(FATAL_ERROR "Ceres bug: Removed all threading models.")
-  endif()
-  set(${CERES_THREADING_MODELS_AVAILABLE_VAR}
-    ${CERES_THREADING_MODELS_AVAILABLE} PARENT_SCOPE)
-endfunction()
-
-macro(set_ceres_threading_model_to_cxx11_threads)
-  list(APPEND CERES_COMPILE_OPTIONS CERES_USE_CXX_THREADS)
-endmacro()
-
-macro(set_ceres_threading_model_to_openmp)
-  find_package(OpenMP REQUIRED)
-  list(APPEND CERES_COMPILE_OPTIONS CERES_USE_OPENMP)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
-endmacro()
-
-macro(set_ceres_threading_model_to_no_threads)
-  list(APPEND CERES_COMPILE_OPTIONS CERES_NO_THREADS)
-endmacro()
-
-macro(set_ceres_threading_model CERES_THREADING_MODEL_TO_SET)
-  if ("${CERES_THREADING_MODEL_TO_SET}" STREQUAL "CXX_THREADS")
-    set_ceres_threading_model_to_cxx11_threads()
-  elseif ("${CERES_THREADING_MODEL_TO_SET}" STREQUAL "OPENMP")
-    set_ceres_threading_model_to_openmp()
-  elseif ("${CERES_THREADING_MODEL_TO_SET}" STREQUAL "NO_THREADS")
-    set_ceres_threading_model_to_no_threads()
-  else()
-    include(PrettyPrintCMakeList)
-    find_available_ceres_threading_models(_AVAILABLE_THREADING_MODELS)
-    pretty_print_cmake_list(
-      _AVAILABLE_THREADING_MODELS ${_AVAILABLE_THREADING_MODELS})
-    message(FATAL_ERROR "Unknown threading model specified: "
-      "'${CERES_THREADING_MODEL_TO_SET}'. Available threading models for "
-      "this platform are: ${_AVAILABLE_THREADING_MODELS}")
-  endif()
-  message("-- Using Ceres threading model: ${CERES_THREADING_MODEL_TO_SET}")
-endmacro()
diff --git a/cmake/CheckIfUnderscorePrefixedBesselFunctionsExist.cmake b/cmake/CheckIfUnderscorePrefixedBesselFunctionsExist.cmake
deleted file mode 100644
index a05721c..0000000
--- a/cmake/CheckIfUnderscorePrefixedBesselFunctionsExist.cmake
+++ /dev/null
@@ -1,54 +0,0 @@
-# Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2017 Google Inc. All rights reserved.
-# http://ceres-solver.org/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors may be
-#   used to endorse or promote products derived from this software without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# Author: alexs.mac@gmail.com (Alex Stewart)
-
-# Microsoft deprecated the POSIX Bessel functions: j[0,1,n]() in favour
-# of _j[0,1,n](), it appears since at least MSVC 2005 [1].  This function
-# checks if the underscore prefixed versions of the Bessel functions are
-# defined, and sets ${HAVE_UNDERSCORE_PREFIXED_BESSEL_FUNCTIONS_VAR} to
-# TRUE if they do.
-#
-# [1] https://msdn.microsoft.com/en-us/library/ms235384(v=vs.100).aspx
-function(check_if_underscore_prefixed_bessel_functions_exist
-    HAVE_UNDERSCORE_PREFIXED_BESSEL_FUNCTIONS_VAR)
-  include(CheckCXXSourceCompiles)
-  check_cxx_source_compiles(
-    "#include <math.h>
-     int main(int argc, char * argv[]) {
-       double result;
-       result = _j0(1.2345);
-       result = _j1(1.2345);
-       result = _jn(2, 1.2345);
-       return 0;
-     }"
-     HAVE_UNDERSCORE_PREFIXED_BESSEL_FUNCTIONS)
-   set(${HAVE_UNDERSCORE_PREFIXED_BESSEL_FUNCTIONS_VAR}
-     ${HAVE_UNDERSCORE_PREFIXED_BESSEL_FUNCTIONS}
-     PARENT_SCOPE)
-endfunction()
diff --git a/cmake/CreateCeresConfig.cmake b/cmake/CreateCeresConfig.cmake
index 89db68c..f0037cc 100644
--- a/cmake/CreateCeresConfig.cmake
+++ b/cmake/CreateCeresConfig.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/DetectBrokenStackCheckMacOSXcodePairing.cmake b/cmake/DetectBrokenStackCheckMacOSXcodePairing.cmake
index 151e28c..f333ed9 100644
--- a/cmake/DetectBrokenStackCheckMacOSXcodePairing.cmake
+++ b/cmake/DetectBrokenStackCheckMacOSXcodePairing.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2019 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/EnableSanitizer.cmake b/cmake/EnableSanitizer.cmake
index 1ef68c3..9a8d484 100644
--- a/cmake/EnableSanitizer.cmake
+++ b/cmake/EnableSanitizer.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2019 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/FindAccelerateSparse.cmake b/cmake/FindAccelerateSparse.cmake
index f2f4340..3a2e431 100644
--- a/cmake/FindAccelerateSparse.cmake
+++ b/cmake/FindAccelerateSparse.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2018 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/FindCXSparse.cmake b/cmake/FindCXSparse.cmake
deleted file mode 100644
index 8b380c9..0000000
--- a/cmake/FindCXSparse.cmake
+++ /dev/null
@@ -1,261 +0,0 @@
-# Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
-# http://ceres-solver.org/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors may be
-#   used to endorse or promote products derived from this software without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# Author: alexs.mac@gmail.com (Alex Stewart)
-#
-
-# FindCXSparse.cmake - Find CXSparse libraries & dependencies.
-#
-# This module defines the following variables which should be referenced
-# by the caller to use the library.
-#
-# CXSPARSE_FOUND: TRUE iff CXSparse and all dependencies have been found.
-# CXSPARSE_INCLUDE_DIRS: Include directories for CXSparse.
-# CXSPARSE_LIBRARIES: Libraries for CXSparse and all dependencies.
-#
-# CXSPARSE_VERSION: Extracted from cs.h.
-# CXSPARSE_MAIN_VERSION: Equal to 3 if CXSPARSE_VERSION = 3.1.2
-# CXSPARSE_SUB_VERSION: Equal to 1 if CXSPARSE_VERSION = 3.1.2
-# CXSPARSE_SUBSUB_VERSION: Equal to 2 if CXSPARSE_VERSION = 3.1.2
-#
-# The following variables control the behaviour of this module:
-#
-# CXSPARSE_INCLUDE_DIR_HINTS: List of additional directories in which to
-#                             search for CXSparse includes,
-#                             e.g: /timbuktu/include.
-# CXSPARSE_LIBRARY_DIR_HINTS: List of additional directories in which to
-#                             search for CXSparse libraries, e.g: /timbuktu/lib.
-#
-# The following variables are also defined by this module, but in line with
-# CMake recommended FindPackage() module style should NOT be referenced directly
-# by callers (use the plural variables detailed above instead).  These variables
-# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which
-# are NOT re-called (i.e. search for library is not repeated) if these variables
-# are set with valid values _in the CMake cache_. This means that if these
-# variables are set directly in the cache, either by the user in the CMake GUI,
-# or by the user passing -DVAR=VALUE directives to CMake when called (which
-# explicitly defines a cache variable), then they will be used verbatim,
-# bypassing the HINTS variables and other hard-coded search locations.
-#
-# CXSPARSE_INCLUDE_DIR: Include directory for CXSparse, not including the
-#                       include directory of any dependencies.
-# CXSPARSE_LIBRARY: CXSparse library, not including the libraries of any
-#                   dependencies.
-
-# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
-# FindCXSparse was invoked.
-macro(CXSPARSE_RESET_FIND_LIBRARY_PREFIX)
-  if (MSVC)
-    set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
-  endif (MSVC)
-endmacro(CXSPARSE_RESET_FIND_LIBRARY_PREFIX)
-
-# Called if we failed to find CXSparse or any of it's required dependencies,
-# unsets all public (designed to be used externally) variables and reports
-# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
-macro(CXSPARSE_REPORT_NOT_FOUND REASON_MSG)
-  unset(CXSPARSE_FOUND)
-  unset(CXSPARSE_INCLUDE_DIRS)
-  unset(CXSPARSE_LIBRARIES)
-  # Make results of search visible in the CMake GUI if CXSparse has not
-  # been found so that user does not have to toggle to advanced view.
-  mark_as_advanced(CLEAR CXSPARSE_INCLUDE_DIR
-                         CXSPARSE_LIBRARY)
-
-  cxsparse_reset_find_library_prefix()
-
-  # Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
-  # use the camelcase library name, not uppercase.
-  if (CXSparse_FIND_QUIETLY)
-    message(STATUS "Failed to find CXSparse - " ${REASON_MSG} ${ARGN})
-  elseif (CXSparse_FIND_REQUIRED)
-    message(FATAL_ERROR "Failed to find CXSparse - " ${REASON_MSG} ${ARGN})
-  else()
-    # Neither QUIETLY nor REQUIRED, use no priority which emits a message
-    # but continues configuration and allows generation.
-    message("-- Failed to find CXSparse - " ${REASON_MSG} ${ARGN})
-  endif ()
-  return()
-endmacro(CXSPARSE_REPORT_NOT_FOUND)
-
-# Protect against any alternative find_package scripts for this library having
-# been called previously (in a client project) which set CXSPARSE_FOUND, but not
-# the other variables we require / set here which could cause the search logic
-# here to fail.
-unset(CXSPARSE_FOUND)
-
-# Handle possible presence of lib prefix for libraries on MSVC, see
-# also CXSPARSE_RESET_FIND_LIBRARY_PREFIX().
-if (MSVC)
-  # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
-  # s/t we can set it back before returning.
-  set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
-  # The empty string in this list is important, it represents the case when
-  # the libraries have no prefix (shared libraries / DLLs).
-  set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
-endif (MSVC)
-
-# On macOS, add the Homebrew prefix (with appropriate suffixes) to the
-# respective HINTS directories (after any user-specified locations).  This
-# handles Homebrew installations into non-standard locations (not /usr/local).
-# We do not use CMAKE_PREFIX_PATH for this as given the search ordering of
-# find_xxx(), doing so would override any user-specified HINTS locations with
-# the Homebrew version if it exists.
-if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
-  find_program(HOMEBREW_EXECUTABLE brew)
-  mark_as_advanced(FORCE HOMEBREW_EXECUTABLE)
-  if (HOMEBREW_EXECUTABLE)
-    # Detected a Homebrew install, query for its install prefix.
-    execute_process(COMMAND ${HOMEBREW_EXECUTABLE} --prefix
-      OUTPUT_VARIABLE HOMEBREW_INSTALL_PREFIX
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-    message(STATUS "Detected Homebrew with install prefix: "
-      "${HOMEBREW_INSTALL_PREFIX}, adding to CMake search paths.")
-    list(APPEND CXSPARSE_INCLUDE_DIR_HINTS "${HOMEBREW_INSTALL_PREFIX}/include")
-    list(APPEND CXSPARSE_LIBRARY_DIR_HINTS "${HOMEBREW_INSTALL_PREFIX}/lib")
-  endif()
-endif()
-
-# Search user-installed locations first, so that we prefer user installs
-# to system installs where both exist.
-#
-# TODO: Add standard Windows search locations for CXSparse.
-list(APPEND CXSPARSE_CHECK_INCLUDE_DIRS
-  /usr/local/include
-  /usr/local/homebrew/include # Mac OS X
-  /opt/local/var/macports/software # Mac OS X.
-  /opt/local/include
-  /usr/include)
-list(APPEND CXSPARSE_CHECK_LIBRARY_DIRS
-  /usr/local/lib
-  /usr/local/homebrew/lib # Mac OS X.
-  /opt/local/lib
-  /usr/lib)
-# Additional suffixes to try appending to each search path.
-list(APPEND CXSPARSE_CHECK_PATH_SUFFIXES
-  suitesparse) # Linux/Windows
-
-# Search supplied hint directories first if supplied.
-find_path(CXSPARSE_INCLUDE_DIR
-  NAMES cs.h
-  HINTS ${CXSPARSE_INCLUDE_DIR_HINTS}
-  PATHS ${CXSPARSE_CHECK_INCLUDE_DIRS}
-  PATH_SUFFIXES ${CXSPARSE_CHECK_PATH_SUFFIXES})
-if (NOT CXSPARSE_INCLUDE_DIR OR
-    NOT EXISTS ${CXSPARSE_INCLUDE_DIR})
-  cxsparse_report_not_found(
-    "Could not find CXSparse include directory, set CXSPARSE_INCLUDE_DIR "
-    "to directory containing cs.h")
-endif (NOT CXSPARSE_INCLUDE_DIR OR
-       NOT EXISTS ${CXSPARSE_INCLUDE_DIR})
-
-find_library(CXSPARSE_LIBRARY NAMES cxsparse
-  HINTS ${CXSPARSE_LIBRARY_DIR_HINTS}
-  PATHS ${CXSPARSE_CHECK_LIBRARY_DIRS}
-  PATH_SUFFIXES ${CXSPARSE_CHECK_PATH_SUFFIXES})
-if (NOT CXSPARSE_LIBRARY OR
-    NOT EXISTS ${CXSPARSE_LIBRARY})
-  cxsparse_report_not_found(
-    "Could not find CXSparse library, set CXSPARSE_LIBRARY "
-    "to full path to libcxsparse.")
-endif (NOT CXSPARSE_LIBRARY OR
-       NOT EXISTS ${CXSPARSE_LIBRARY})
-
-# Mark internally as found, then verify. CXSPARSE_REPORT_NOT_FOUND() unsets
-# if called.
-set(CXSPARSE_FOUND TRUE)
-
-# Extract CXSparse version from cs.h
-if (CXSPARSE_INCLUDE_DIR)
-  set(CXSPARSE_VERSION_FILE ${CXSPARSE_INCLUDE_DIR}/cs.h)
-  if (NOT EXISTS ${CXSPARSE_VERSION_FILE})
-    cxsparse_report_not_found(
-      "Could not find file: ${CXSPARSE_VERSION_FILE} "
-      "containing version information in CXSparse install located at: "
-      "${CXSPARSE_INCLUDE_DIR}.")
-  else (NOT EXISTS ${CXSPARSE_VERSION_FILE})
-    file(READ ${CXSPARSE_INCLUDE_DIR}/cs.h CXSPARSE_VERSION_FILE_CONTENTS)
-
-    string(REGEX MATCH "#define CS_VER [0-9]+"
-      CXSPARSE_MAIN_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}")
-    string(REGEX REPLACE "#define CS_VER ([0-9]+)" "\\1"
-      CXSPARSE_MAIN_VERSION "${CXSPARSE_MAIN_VERSION}")
-
-    string(REGEX MATCH "#define CS_SUBVER [0-9]+"
-      CXSPARSE_SUB_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}")
-    string(REGEX REPLACE "#define CS_SUBVER ([0-9]+)" "\\1"
-      CXSPARSE_SUB_VERSION "${CXSPARSE_SUB_VERSION}")
-
-    string(REGEX MATCH "#define CS_SUBSUB [0-9]+"
-      CXSPARSE_SUBSUB_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}")
-    string(REGEX REPLACE "#define CS_SUBSUB ([0-9]+)" "\\1"
-      CXSPARSE_SUBSUB_VERSION "${CXSPARSE_SUBSUB_VERSION}")
-
-    # This is on a single line s/t CMake does not interpret it as a list of
-    # elements and insert ';' separators which would result in 3.;1.;2 nonsense.
-    set(CXSPARSE_VERSION "${CXSPARSE_MAIN_VERSION}.${CXSPARSE_SUB_VERSION}.${CXSPARSE_SUBSUB_VERSION}")
-  endif (NOT EXISTS ${CXSPARSE_VERSION_FILE})
-endif (CXSPARSE_INCLUDE_DIR)
-
-# Catch the case when the caller has set CXSPARSE_LIBRARY in the cache / GUI and
-# thus FIND_LIBRARY was not called, but specified library is invalid, otherwise
-# we would report CXSparse as found.
-# TODO: This regex for CXSparse library is pretty primitive, we use lowercase
-#       for comparison to handle Windows using CamelCase library names, could
-#       this check be better?
-string(TOLOWER "${CXSPARSE_LIBRARY}" LOWERCASE_CXSPARSE_LIBRARY)
-if (CXSPARSE_LIBRARY AND
-    EXISTS ${CXSPARSE_LIBRARY} AND
-    NOT "${LOWERCASE_CXSPARSE_LIBRARY}" MATCHES ".*cxsparse[^/]*")
-  cxsparse_report_not_found(
-    "Caller defined CXSPARSE_LIBRARY: "
-    "${CXSPARSE_LIBRARY} does not match CXSparse.")
-endif (CXSPARSE_LIBRARY AND
-       EXISTS ${CXSPARSE_LIBRARY} AND
-       NOT "${LOWERCASE_CXSPARSE_LIBRARY}" MATCHES ".*cxsparse[^/]*")
-
-# Set standard CMake FindPackage variables if found.
-if (CXSPARSE_FOUND)
-  set(CXSPARSE_INCLUDE_DIRS ${CXSPARSE_INCLUDE_DIR})
-  set(CXSPARSE_LIBRARIES ${CXSPARSE_LIBRARY})
-endif (CXSPARSE_FOUND)
-
-cxsparse_reset_find_library_prefix()
-
-# Handle REQUIRED / QUIET optional arguments and version.
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(CXSparse
-  REQUIRED_VARS CXSPARSE_INCLUDE_DIRS CXSPARSE_LIBRARIES
-  VERSION_VAR CXSPARSE_VERSION)
-
-# Only mark internal variables as advanced if we found CXSparse, otherwise
-# leave them visible in the standard GUI for the user to set manually.
-if (CXSPARSE_FOUND)
-  mark_as_advanced(FORCE CXSPARSE_INCLUDE_DIR
-                         CXSPARSE_LIBRARY)
-endif (CXSPARSE_FOUND)
diff --git a/cmake/FindGlog.cmake b/cmake/FindGlog.cmake
index 1a7b6c0..2ef6914 100644
--- a/cmake/FindGlog.cmake
+++ b/cmake/FindGlog.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
@@ -345,6 +345,11 @@
   endif (GLOG_LIBRARY AND
     NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*")
 
+  # add glog::glog target
+  add_library(glog::glog INTERFACE IMPORTED)
+  target_include_directories(glog::glog INTERFACE ${GLOG_INCLUDE_DIRS})
+  target_link_libraries(glog::glog INTERFACE ${GLOG_LIBRARY})
+
   glog_reset_find_library_prefix()
 
 endif(NOT GLOG_FOUND)
diff --git a/cmake/FindMETIS.cmake b/cmake/FindMETIS.cmake
new file mode 100644
index 0000000..5f41792
--- /dev/null
+++ b/cmake/FindMETIS.cmake
@@ -0,0 +1,110 @@
+#
+# Copyright (c) 2022 Sergiu Deitsch
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTMETISLAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+#[=======================================================================[.rst:
+Module for locating METIS
+=========================
+
+Read-only variables:
+
+``METIS_FOUND``
+  Indicates whether the library has been found.
+
+``METIS_VERSION``
+  Indicates library version.
+
+Targets
+-------
+
+``METIS::METIS``
+  Specifies targets that should be passed to target_link_libararies.
+]=======================================================================]
+
+include (FindPackageHandleStandardArgs)
+
+find_path (METIS_INCLUDE_DIR NAMES metis.h
+  PATH_SUFFIXES include
+  DOC "METIS include directory")
+find_library (METIS_LIBRARY_DEBUG NAMES metis
+  PATH_SUFFIXES Debug
+  DOC "METIS debug library")
+find_library (METIS_LIBRARY_RELEASE NAMES metis
+  PATH_SUFFIXES Release
+  DOC "METIS release library")
+
+if (METIS_LIBRARY_RELEASE)
+  if (METIS_LIBRARY_DEBUG)
+    set (METIS_LIBRARY debug ${METIS_LIBRARY_DEBUG} optimized
+      ${METIS_LIBRARY_RELEASE} CACHE STRING "METIS library")
+  else (METIS_LIBRARY_DEBUG)
+    set (METIS_LIBRARY ${METIS_LIBRARY_RELEASE} CACHE FILEPATH "METIS library")
+  endif (METIS_LIBRARY_DEBUG)
+elseif (METIS_LIBRARY_DEBUG)
+  set (METIS_LIBRARY ${METIS_LIBRARY_DEBUG} CACHE FILEPATH "METIS library")
+endif (METIS_LIBRARY_RELEASE)
+
+set (_METIS_VERSION_HEADER ${METIS_INCLUDE_DIR}/metis.h)
+
+if (EXISTS ${_METIS_VERSION_HEADER})
+  file (READ ${_METIS_VERSION_HEADER} _METIS_VERSION_CONTENTS)
+
+  string (REGEX REPLACE ".*#define METIS_VER_MAJOR[ \t]+([0-9]+).*" "\\1"
+    METIS_VERSION_MAJOR "${_METIS_VERSION_CONTENTS}")
+  string (REGEX REPLACE ".*#define METIS_VER_MINOR[ \t]+([0-9]+).*" "\\1"
+    METIS_VERSION_MINOR "${_METIS_VERSION_CONTENTS}")
+  string (REGEX REPLACE ".*#define METIS_VER_SUBMINOR[ \t]+([0-9]+).*" "\\1"
+    METIS_VERSION_PATCH "${_METIS_VERSION_CONTENTS}")
+
+  set (METIS_VERSION
+    ${METIS_VERSION_MAJOR}.${METIS_VERSION_MINOR}.${METIS_VERSION_PATCH})
+  set (METIS_VERSION_COMPONENTS 3)
+endif (EXISTS ${_METIS_VERSION_HEADER})
+
+mark_as_advanced (METIS_INCLUDE_DIR METIS_LIBRARY_DEBUG METIS_LIBRARY_RELEASE
+  METIS_LIBRARY)
+
+if (NOT TARGET METIS::METIS)
+  if (METIS_INCLUDE_DIR OR METIS_LIBRARY)
+    add_library (METIS::METIS IMPORTED UNKNOWN)
+  endif (METIS_INCLUDE_DIR OR METIS_LIBRARY)
+endif (NOT TARGET METIS::METIS)
+
+if (METIS_INCLUDE_DIR)
+  set_property (TARGET METIS::METIS PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+    ${METIS_INCLUDE_DIR})
+endif (METIS_INCLUDE_DIR)
+
+if (METIS_LIBRARY_RELEASE)
+  set_property (TARGET METIS::METIS PROPERTY IMPORTED_LOCATION_RELEASE
+    ${METIS_LIBRARY_RELEASE})
+  set_property (TARGET METIS::METIS APPEND PROPERTY IMPORTED_CONFIGURATIONS
+    RELEASE)
+endif (METIS_LIBRARY_RELEASE)
+
+if (METIS_LIBRARY_DEBUG)
+  set_property (TARGET METIS::METIS PROPERTY IMPORTED_LOCATION_DEBUG
+    ${METIS_LIBRARY_DEBUG})
+  set_property (TARGET METIS::METIS APPEND PROPERTY IMPORTED_CONFIGURATIONS
+    DEBUG)
+endif (METIS_LIBRARY_DEBUG)
+
+find_package_handle_standard_args (METIS REQUIRED_VARS
+  METIS_INCLUDE_DIR METIS_LIBRARY VERSION_VAR METIS_VERSION)
diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake
index 220108d..d1488eb 100644
--- a/cmake/FindSphinx.cmake
+++ b/cmake/FindSphinx.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
@@ -29,38 +29,96 @@
 # Author: pablo.speciale@gmail.com (Pablo Speciale)
 #
 
-# Find the Sphinx documentation generator
-#
-# This modules defines
-#  SPHINX_EXECUTABLE
-#  SPHINX_FOUND
+#[=======================================================================[.rst:
+FindSphinx
+==========
 
-find_program(SPHINX_EXECUTABLE
-             NAMES sphinx-build
-             PATHS
-               /usr/bin
-               /usr/local/bin
-               /opt/local/bin
-             DOC "Sphinx documentation generator")
+Module for locating Sphinx and its components.
 
-if (NOT SPHINX_EXECUTABLE)
-  set(_Python_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
+This modules defines the following variables:
 
-  foreach (_version ${_Python_VERSIONS})
-    set(_sphinx_NAMES sphinx-build-${_version})
+``Sphinx_FOUND``
+  ``TRUE`` iff Sphinx and all of its components have been found.
 
-    find_program(SPHINX_EXECUTABLE
-                 NAMES ${_sphinx_NAMES}
-                 PATHS
-                   /usr/bin
-                   /usr/local/bin
-                   /opt/local/bin
-                 DOC "Sphinx documentation generator")
-  endforeach ()
-endif ()
+``Sphinx_BUILD_EXECUTABLE``
+  Path to the ``sphinx-build`` tool.
+]=======================================================================]
 
-include(FindPackageHandleStandardArgs)
+include (FindPackageHandleStandardArgs)
 
-find_package_handle_standard_args(Sphinx DEFAULT_MSG SPHINX_EXECUTABLE)
+find_program (Sphinx_BUILD_EXECUTABLE
+  NAMES sphinx-build
+  PATHS /opt/local/bin
+  DOC "Sphinx documentation generator"
+)
 
-mark_as_advanced(SPHINX_EXECUTABLE)
+mark_as_advanced (Sphinx_BUILD_EXECUTABLE)
+
+if (Sphinx_BUILD_EXECUTABLE)
+  execute_process (
+    COMMAND ${Sphinx_BUILD_EXECUTABLE} --version
+    ERROR_STRIP_TRAILING_WHITESPACE
+    ERROR_VARIABLE _Sphinx_BUILD_ERROR
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    OUTPUT_VARIABLE _Sphinx_VERSION_STRING
+    RESULT_VARIABLE _Sphinx_BUILD_RESULT
+  )
+
+  if (_Sphinx_BUILD_RESULT EQUAL 0)
+    string (REGEX REPLACE "^sphinx-build[ \t]+([^ \t]+)$" "\\1" Sphinx_VERSION
+      "${_Sphinx_VERSION_STRING}")
+
+    if (Sphinx_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+      set (Sphinx_VERSION_COMPONENTS 3)
+      set (Sphinx_VERSION_MAJOR ${CMAKE_MATCH_1})
+      set (Sphinx_VERSION_MINOR ${CMAKE_MATCH_2})
+      set (Sphinx_VERSION_PATCH ${CMAKE_MATCH_3})
+    endif (Sphinx_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+  else (_Sphinx_BUILD_RESULT EQUAL 0)
+    message (WARNING "Could not determine sphinx-build version: ${_Sphinx_BUILD_ERROR}")
+  endif (_Sphinx_BUILD_RESULT EQUAL 0)
+
+  unset (_Sphinx_BUILD_ERROR)
+  unset (_Sphinx_BUILD_RESULT)
+  unset (_Sphinx_VERSION_STRING)
+
+  find_package (Python COMPONENTS Interpreter)
+  set (_Sphinx_BUILD_RESULT FALSE)
+
+  if (Python_Interpreter_FOUND)
+    # Check for Sphinx theme dependency for documentation
+    foreach (component IN LISTS Sphinx_FIND_COMPONENTS)
+      string (REGEX MATCH "^(.+_theme)$" theme_component "${component}")
+
+      if (NOT theme_component STREQUAL component)
+        continue ()
+      endif (NOT theme_component STREQUAL component)
+
+      execute_process (
+        COMMAND ${Python_EXECUTABLE} -c "import ${theme_component}"
+        ERROR_STRIP_TRAILING_WHITESPACE
+        ERROR_VARIABLE _Sphinx_BUILD_ERROR
+        OUTPUT_QUIET
+        RESULT_VARIABLE _Sphinx_BUILD_RESULT
+      )
+
+      if (_Sphinx_BUILD_RESULT EQUAL 0)
+        set (Sphinx_${component}_FOUND TRUE)
+      elseif (_Sphinx_BUILD_RESULT EQUAL 0)
+        message (WARNING "Could not determine whether Sphinx component '${theme_component}' is available: ${_Sphinx_BUILD_ERROR}")
+        set (Sphinx_${component}_FOUND FALSE)
+      endif (_Sphinx_BUILD_RESULT EQUAL 0)
+
+      unset (_Sphinx_BUILD_ERROR)
+      unset (_Sphinx_BUILD_RESULT)
+    endforeach (component)
+
+    unset (theme_component)
+  endif (Python_Interpreter_FOUND)
+endif (Sphinx_BUILD_EXECUTABLE)
+
+find_package_handle_standard_args (Sphinx
+  REQUIRED_VARS Sphinx_BUILD_EXECUTABLE
+  VERSION_VAR Sphinx_VERSION
+  HANDLE_COMPONENTS
+)
diff --git a/cmake/FindSuiteSparse.cmake b/cmake/FindSuiteSparse.cmake
index aad8904..49c089c 100644
--- a/cmake/FindSuiteSparse.cmake
+++ b/cmake/FindSuiteSparse.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
@@ -29,103 +29,146 @@
 # Author: alexs.mac@gmail.com (Alex Stewart)
 #
 
-# FindSuiteSparse.cmake - Find SuiteSparse libraries & dependencies.
-#
-# This module defines the following variables:
-#
-# SUITESPARSE_FOUND: TRUE iff SuiteSparse and all dependencies have been found.
-# SUITESPARSE_INCLUDE_DIRS: Include directories for all SuiteSparse components.
-# SUITESPARSE_LIBRARIES: Libraries for all SuiteSparse component libraries and
-#                        dependencies.
-# SUITESPARSE_VERSION: Extracted from UFconfig.h (<= v3) or
-#                      SuiteSparse_config.h (>= v4).
-# SUITESPARSE_MAIN_VERSION: Equal to 4 if SUITESPARSE_VERSION = 4.2.1
-# SUITESPARSE_SUB_VERSION: Equal to 2 if SUITESPARSE_VERSION = 4.2.1
-# SUITESPARSE_SUBSUB_VERSION: Equal to 1 if SUITESPARSE_VERSION = 4.2.1
-#
-# SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION: TRUE iff running
-#     on Ubuntu, SUITESPARSE_VERSION is 3.4.0 and found SuiteSparse is a system
-#     install, in which case found version of SuiteSparse cannot be used to link
-#     a shared library due to a bug (static linking is unaffected).
-#
-# The following variables control the behaviour of this module:
-#
-# SUITESPARSE_INCLUDE_DIR_HINTS: List of additional directories in which to
-#                                search for SuiteSparse includes,
-#                                e.g: /timbuktu/include.
-# SUITESPARSE_LIBRARY_DIR_HINTS: List of additional directories in which to
-#                                search for SuiteSparse libraries,
-#                                e.g: /timbuktu/lib.
-#
-# The following variables define the presence / includes & libraries for the
-# SuiteSparse components searched for, the SUITESPARSE_XX variables are the
-# union of the variables for all components.
-#
-# == Symmetric Approximate Minimum Degree (AMD)
-# AMD_FOUND
-# AMD_INCLUDE_DIR
-# AMD_LIBRARY
-#
-# == Constrained Approximate Minimum Degree (CAMD)
-# CAMD_FOUND
-# CAMD_INCLUDE_DIR
-# CAMD_LIBRARY
-#
-# == Column Approximate Minimum Degree (COLAMD)
-# COLAMD_FOUND
-# COLAMD_INCLUDE_DIR
-# COLAMD_LIBRARY
-#
-# Constrained Column Approximate Minimum Degree (CCOLAMD)
-# CCOLAMD_FOUND
-# CCOLAMD_INCLUDE_DIR
-# CCOLAMD_LIBRARY
-#
-# == Sparse Supernodal Cholesky Factorization and Update/Downdate (CHOLMOD)
-# CHOLMOD_FOUND
-# CHOLMOD_INCLUDE_DIR
-# CHOLMOD_LIBRARY
-#
-# == Multifrontal Sparse QR (SuiteSparseQR)
-# SUITESPARSEQR_FOUND
-# SUITESPARSEQR_INCLUDE_DIR
-# SUITESPARSEQR_LIBRARY
-#
-# == Common configuration for all but CSparse (SuiteSparse version >= 4).
-# SUITESPARSE_CONFIG_FOUND
-# SUITESPARSE_CONFIG_INCLUDE_DIR
-# SUITESPARSE_CONFIG_LIBRARY
-#
-# == Common configuration for all but CSparse (SuiteSparse version < 4).
-# UFCONFIG_FOUND
-# UFCONFIG_INCLUDE_DIR
-#
-# Optional SuiteSparse Dependencies:
-#
-# == Serial Graph Partitioning and Fill-reducing Matrix Ordering (METIS)
-# METIS_FOUND
-# METIS_LIBRARY
+#[=======================================================================[.rst:
+FindSuiteSparse
+===============
+
+Module for locating SuiteSparse libraries and its dependencies.
+
+This module defines the following variables:
+
+``SuiteSparse_FOUND``
+   ``TRUE`` iff SuiteSparse and all dependencies have been found.
+
+``SuiteSparse_VERSION``
+   Extracted from ``SuiteSparse_config.h`` (>= v4).
+
+``SuiteSparse_VERSION_MAJOR``
+    Equal to 4 if ``SuiteSparse_VERSION`` = 4.2.1
+
+``SuiteSparse_VERSION_MINOR``
+    Equal to 2 if ``SuiteSparse_VERSION`` = 4.2.1
+
+``SuiteSparse_VERSION_PATCH``
+    Equal to 1 if ``SuiteSparse_VERSION`` = 4.2.1
+
+The following variables control the behaviour of this module:
+
+``SuiteSparse_NO_CMAKE``
+  Do not attempt to use the native SuiteSparse CMake package configuration.
+
+
+Targets
+-------
+
+The following targets define the SuiteSparse components searched for.
+
+``SuiteSparse::AMD``
+    Symmetric Approximate Minimum Degree (AMD)
+
+``SuiteSparse::CAMD``
+    Constrained Approximate Minimum Degree (CAMD)
+
+``SuiteSparse::COLAMD``
+    Column Approximate Minimum Degree (COLAMD)
+
+``SuiteSparse::CCOLAMD``
+    Constrained Column Approximate Minimum Degree (CCOLAMD)
+
+``SuiteSparse::CHOLMOD``
+    Sparse Supernodal Cholesky Factorization and Update/Downdate (CHOLMOD)
+
+``SuiteSparse::Partition``
+    CHOLMOD with METIS support
+
+``SuiteSparse::SPQR``
+    Multifrontal Sparse QR (SuiteSparseQR)
+
+``SuiteSparse::Config``
+    Common configuration for all but CSparse (SuiteSparse version >= 4).
+
+Optional SuiteSparse dependencies:
+
+``METIS::METIS``
+    Serial Graph Partitioning and Fill-reducing Matrix Ordering (METIS)
+]=======================================================================]
+
+if (NOT SuiteSparse_NO_CMAKE)
+  find_package (SuiteSparse NO_MODULE QUIET)
+endif (NOT SuiteSparse_NO_CMAKE)
+
+if (SuiteSparse_FOUND)
+  return ()
+endif (SuiteSparse_FOUND)
+
+# Push CMP0057 to enable support for IN_LIST, when cmake_minimum_required is
+# set to <3.3.
+cmake_policy (PUSH)
+cmake_policy (SET CMP0057 NEW)
+
+if (NOT SuiteSparse_FIND_COMPONENTS)
+  set (SuiteSparse_FIND_COMPONENTS
+    AMD
+    CAMD
+    CCOLAMD
+    CHOLMOD
+    COLAMD
+    SPQR
+  )
+
+  foreach (component IN LISTS SuiteSparse_FIND_COMPONENTS)
+    set (SuiteSparse_FIND_REQUIRED_${component} TRUE)
+  endforeach (component IN LISTS SuiteSparse_FIND_COMPONENTS)
+endif (NOT SuiteSparse_FIND_COMPONENTS)
+
+# Assume SuiteSparse was found and set it to false only if third-party
+# dependencies could not be located. SuiteSparse components are handled by
+# FindPackageHandleStandardArgs HANDLE_COMPONENTS option.
+set (SuiteSparse_FOUND TRUE)
+
+include (CheckLibraryExists)
+include (CheckSymbolExists)
+include (CMakePushCheckState)
+
+# Config is a base component and thus always required
+set (SuiteSparse_IMPLICIT_COMPONENTS Config)
+
+# CHOLMOD depends on AMD, CAMD, CCOLAMD, and COLAMD.
+if (CHOLMOD IN_LIST SuiteSparse_FIND_COMPONENTS)
+  list (APPEND SuiteSparse_IMPLICIT_COMPONENTS AMD CAMD CCOLAMD COLAMD)
+endif (CHOLMOD IN_LIST SuiteSparse_FIND_COMPONENTS)
+
+# SPQR depends on CHOLMOD.
+if (SPQR IN_LIST SuiteSparse_FIND_COMPONENTS)
+  list (APPEND SuiteSparse_IMPLICIT_COMPONENTS CHOLMOD)
+endif (SPQR IN_LIST SuiteSparse_FIND_COMPONENTS)
+
+# Implicit components are always required
+foreach (component IN LISTS SuiteSparse_IMPLICIT_COMPONENTS)
+  set (SuiteSparse_FIND_REQUIRED_${component} TRUE)
+endforeach (component IN LISTS SuiteSparse_IMPLICIT_COMPONENTS)
+
+list (APPEND SuiteSparse_FIND_COMPONENTS ${SuiteSparse_IMPLICIT_COMPONENTS})
+
+# Do not list components multiple times.
+list (REMOVE_DUPLICATES SuiteSparse_FIND_COMPONENTS)
 
 # Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
 # FindSuiteSparse was invoked.
-macro(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
+macro(SuiteSparse_RESET_FIND_LIBRARY_PREFIX)
   if (MSVC)
     set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
   endif (MSVC)
-endmacro(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
+endmacro(SuiteSparse_RESET_FIND_LIBRARY_PREFIX)
 
 # Called if we failed to find SuiteSparse or any of it's required dependencies,
 # unsets all public (designed to be used externally) variables and reports
 # error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
-macro(SUITESPARSE_REPORT_NOT_FOUND REASON_MSG)
-  unset(SUITESPARSE_FOUND)
-  unset(SUITESPARSE_INCLUDE_DIRS)
-  unset(SUITESPARSE_LIBRARIES)
-  unset(SUITESPARSE_VERSION)
-  unset(SUITESPARSE_MAIN_VERSION)
-  unset(SUITESPARSE_SUB_VERSION)
-  unset(SUITESPARSE_SUBSUB_VERSION)
-  # Do NOT unset SUITESPARSE_FOUND_REQUIRED_VARS here, as it is used by
+macro(SuiteSparse_REPORT_NOT_FOUND REASON_MSG)
+  # Will be set to FALSE by find_package_handle_standard_args
+  unset (SuiteSparse_FOUND)
+
+  # Do NOT unset SuiteSparse_REQUIRED_VARS here, as it is used by
   # FindPackageHandleStandardArgs() to generate the automatic error message on
   # failure which highlights which components are missing.
 
@@ -146,16 +189,10 @@
   # Do not call return(), s/t we keep processing if not called with REQUIRED
   # and report all missing components, rather than bailing after failing to find
   # the first.
-endmacro(SUITESPARSE_REPORT_NOT_FOUND)
-
-# Protect against any alternative find_package scripts for this library having
-# been called previously (in a client project) which set SUITESPARSE_FOUND, but
-# not the other variables we require / set here which could cause the search
-# logic here to fail.
-unset(SUITESPARSE_FOUND)
+endmacro(SuiteSparse_REPORT_NOT_FOUND)
 
 # Handle possible presence of lib prefix for libraries on MSVC, see
-# also SUITESPARSE_RESET_FIND_LIBRARY_PREFIX().
+# also SuiteSparse_RESET_FIND_LIBRARY_PREFIX().
 if (MSVC)
   # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
   # s/t we can set it back before returning.
@@ -165,119 +202,92 @@
   set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
 endif (MSVC)
 
-# On macOS, add the Homebrew prefix (with appropriate suffixes) to the
-# respective HINTS directories (after any user-specified locations).  This
-# handles Homebrew installations into non-standard locations (not /usr/local).
-# We do not use CMAKE_PREFIX_PATH for this as given the search ordering of
-# find_xxx(), doing so would override any user-specified HINTS locations with
-# the Homebrew version if it exists.
-if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
-  find_program(HOMEBREW_EXECUTABLE brew)
-  mark_as_advanced(FORCE HOMEBREW_EXECUTABLE)
-  if (HOMEBREW_EXECUTABLE)
-    # Detected a Homebrew install, query for its install prefix.
-    execute_process(COMMAND ${HOMEBREW_EXECUTABLE} --prefix
-      OUTPUT_VARIABLE HOMEBREW_INSTALL_PREFIX
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-    message(STATUS "Detected Homebrew with install prefix: "
-      "${HOMEBREW_INSTALL_PREFIX}, adding to CMake search paths.")
-    list(APPEND SUITESPARSE_INCLUDE_DIR_HINTS "${HOMEBREW_INSTALL_PREFIX}/include")
-    list(APPEND SUITESPARSE_LIBRARY_DIR_HINTS "${HOMEBREW_INSTALL_PREFIX}/lib")
-  endif()
-endif()
-
-# Specify search directories for include files and libraries (this is the union
-# of the search directories for all OSs).  Search user-specified hint
-# directories first if supplied, and search user-installed locations first
-# so that we prefer user installs to system installs where both exist.
-list(APPEND SUITESPARSE_CHECK_INCLUDE_DIRS
-  /opt/local/include
-  /opt/local/include/ufsparse # Mac OS X
-  /usr/local/homebrew/include # Mac OS X
-  /usr/local/include
-  /usr/include)
-list(APPEND SUITESPARSE_CHECK_LIBRARY_DIRS
-  /opt/local/lib
-  /opt/local/lib/ufsparse # Mac OS X
-  /usr/local/homebrew/lib # Mac OS X
-  /usr/local/lib
-  /usr/lib)
 # Additional suffixes to try appending to each search path.
-list(APPEND SUITESPARSE_CHECK_PATH_SUFFIXES
+list(APPEND SuiteSparse_CHECK_PATH_SUFFIXES
   suitesparse) # Windows/Ubuntu
 
 # Wrappers to find_path/library that pass the SuiteSparse search hints/paths.
 #
 # suitesparse_find_component(<component> [FILES name1 [name2 ...]]
-#                                        [LIBRARIES name1 [name2 ...]]
-#                                        [REQUIRED])
+#                                        [LIBRARIES name1 [name2 ...]])
 macro(suitesparse_find_component COMPONENT)
   include(CMakeParseArguments)
-  set(OPTIONS REQUIRED)
   set(MULTI_VALUE_ARGS FILES LIBRARIES)
-  cmake_parse_arguments(SUITESPARSE_FIND_${COMPONENT}
-    "${OPTIONS}" "" "${MULTI_VALUE_ARGS}" ${ARGN})
+  cmake_parse_arguments(SuiteSparse_FIND_COMPONENT_${COMPONENT}
+    "" "" "${MULTI_VALUE_ARGS}" ${ARGN})
 
-  if (SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
-    list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS ${COMPONENT}_FOUND)
-  endif()
-
-  set(${COMPONENT}_FOUND TRUE)
-  if (SUITESPARSE_FIND_${COMPONENT}_FILES)
-    find_path(${COMPONENT}_INCLUDE_DIR
-      NAMES ${SUITESPARSE_FIND_${COMPONENT}_FILES}
-      HINTS ${SUITESPARSE_INCLUDE_DIR_HINTS}
-      PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
-      PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
-    if (${COMPONENT}_INCLUDE_DIR)
+  set(SuiteSparse_${COMPONENT}_FOUND TRUE)
+  if (SuiteSparse_FIND_COMPONENT_${COMPONENT}_FILES)
+    find_path(SuiteSparse_${COMPONENT}_INCLUDE_DIR
+      NAMES ${SuiteSparse_FIND_COMPONENT_${COMPONENT}_FILES}
+      PATH_SUFFIXES ${SuiteSparse_CHECK_PATH_SUFFIXES})
+    if (SuiteSparse_${COMPONENT}_INCLUDE_DIR)
       message(STATUS "Found ${COMPONENT} headers in: "
-        "${${COMPONENT}_INCLUDE_DIR}")
-      mark_as_advanced(${COMPONENT}_INCLUDE_DIR)
+        "${SuiteSparse_${COMPONENT}_INCLUDE_DIR}")
+      mark_as_advanced(SuiteSparse_${COMPONENT}_INCLUDE_DIR)
     else()
       # Specified headers not found.
-      set(${COMPONENT}_FOUND FALSE)
-      if (SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
+      set(SuiteSparse_${COMPONENT}_FOUND FALSE)
+      if (SuiteSparse_FIND_REQUIRED_${COMPONENT})
         suitesparse_report_not_found(
           "Did not find ${COMPONENT} header (required SuiteSparse component).")
       else()
         message(STATUS "Did not find ${COMPONENT} header (optional "
           "SuiteSparse component).")
         # Hide optional vars from CMake GUI even if not found.
-        mark_as_advanced(${COMPONENT}_INCLUDE_DIR)
+        mark_as_advanced(SuiteSparse_${COMPONENT}_INCLUDE_DIR)
       endif()
     endif()
   endif()
 
-  if (SUITESPARSE_FIND_${COMPONENT}_LIBRARIES)
-    find_library(${COMPONENT}_LIBRARY
-      NAMES ${SUITESPARSE_FIND_${COMPONENT}_LIBRARIES}
-      HINTS ${SUITESPARSE_LIBRARY_DIR_HINTS}
-      PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
-      PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
-    if (${COMPONENT}_LIBRARY)
-      message(STATUS "Found ${COMPONENT} library: ${${COMPONENT}_LIBRARY}")
-      mark_as_advanced(${COMPONENT}_LIBRARY)
+  if (SuiteSparse_FIND_COMPONENT_${COMPONENT}_LIBRARIES)
+    find_library(SuiteSparse_${COMPONENT}_LIBRARY
+      NAMES ${SuiteSparse_FIND_COMPONENT_${COMPONENT}_LIBRARIES}
+      PATH_SUFFIXES ${SuiteSparse_CHECK_PATH_SUFFIXES})
+    if (SuiteSparse_${COMPONENT}_LIBRARY)
+      message(STATUS "Found ${COMPONENT} library: ${SuiteSparse_${COMPONENT}_LIBRARY}")
+      mark_as_advanced(SuiteSparse_${COMPONENT}_LIBRARY)
     else ()
       # Specified libraries not found.
-      set(${COMPONENT}_FOUND FALSE)
-      if (SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
+      set(SuiteSparse_${COMPONENT}_FOUND FALSE)
+      if (SuiteSparse_FIND_REQUIRED_${COMPONENT})
         suitesparse_report_not_found(
           "Did not find ${COMPONENT} library (required SuiteSparse component).")
       else()
         message(STATUS "Did not find ${COMPONENT} library (optional SuiteSparse "
           "dependency)")
         # Hide optional vars from CMake GUI even if not found.
-        mark_as_advanced(${COMPONENT}_LIBRARY)
+        mark_as_advanced(SuiteSparse_${COMPONENT}_LIBRARY)
       endif()
     endif()
   endif()
+
+  # A component can be optional (given to OPTIONAL_COMPONENTS). However, if the
+  # component is implicit (must be always present, such as the Config component)
+  # assume it be required as well.
+  if (SuiteSparse_FIND_REQUIRED_${COMPONENT})
+    list (APPEND SuiteSparse_REQUIRED_VARS SuiteSparse_${COMPONENT}_INCLUDE_DIR)
+    list (APPEND SuiteSparse_REQUIRED_VARS SuiteSparse_${COMPONENT}_LIBRARY)
+  endif (SuiteSparse_FIND_REQUIRED_${COMPONENT})
+
+  # Define the target only if the include directory and the library were found
+  if (SuiteSparse_${COMPONENT}_INCLUDE_DIR AND SuiteSparse_${COMPONENT}_LIBRARY)
+    if (NOT TARGET SuiteSparse::${COMPONENT})
+      add_library(SuiteSparse::${COMPONENT} IMPORTED UNKNOWN)
+    endif (NOT TARGET SuiteSparse::${COMPONENT})
+
+    set_property(TARGET SuiteSparse::${COMPONENT} PROPERTY
+      INTERFACE_INCLUDE_DIRECTORIES ${SuiteSparse_${COMPONENT}_INCLUDE_DIR})
+    set_property(TARGET SuiteSparse::${COMPONENT} PROPERTY
+      IMPORTED_LOCATION ${SuiteSparse_${COMPONENT}_LIBRARY})
+  endif (SuiteSparse_${COMPONENT}_INCLUDE_DIR AND SuiteSparse_${COMPONENT}_LIBRARY)
 endmacro()
 
 # Given the number of components of SuiteSparse, and to ensure that the
 # automatic failure message generated by FindPackageHandleStandardArgs()
 # when not all required components are found is helpful, we maintain a list
 # of all variables that must be defined for SuiteSparse to be considered found.
-unset(SUITESPARSE_FOUND_REQUIRED_VARS)
+unset(SuiteSparse_REQUIRED_VARS)
 
 # BLAS.
 find_package(BLAS QUIET)
@@ -285,7 +295,6 @@
   suitesparse_report_not_found(
     "Did not find BLAS library (required for SuiteSparse).")
 endif (NOT BLAS_FOUND)
-list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS BLAS_FOUND)
 
 # LAPACK.
 find_package(LAPACK QUIET)
@@ -293,239 +302,226 @@
   suitesparse_report_not_found(
     "Did not find LAPACK library (required for SuiteSparse).")
 endif (NOT LAPACK_FOUND)
-list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS LAPACK_FOUND)
 
-suitesparse_find_component(AMD REQUIRED FILES amd.h LIBRARIES amd)
-suitesparse_find_component(CAMD REQUIRED FILES camd.h LIBRARIES camd)
-suitesparse_find_component(COLAMD REQUIRED FILES colamd.h LIBRARIES colamd)
-suitesparse_find_component(CCOLAMD REQUIRED FILES ccolamd.h LIBRARIES ccolamd)
-suitesparse_find_component(CHOLMOD REQUIRED FILES cholmod.h LIBRARIES cholmod)
-suitesparse_find_component(
-  SUITESPARSEQR REQUIRED FILES SuiteSparseQR.hpp LIBRARIES spqr)
-if (SUITESPARSEQR_FOUND)
+foreach (component IN LISTS SuiteSparse_FIND_COMPONENTS)
+  if (component STREQUAL Partition)
+    # Partition is a meta component that neither provides additional headers nor
+    # a separate library. It is strictly part of CHOLMOD.
+    continue ()
+  endif (component STREQUAL Partition)
+  string (TOLOWER ${component} component_library)
+
+  if (component STREQUAL "Config")
+    set (component_header SuiteSparse_config.h)
+    set (component_library suitesparseconfig)
+  elseif (component STREQUAL "SPQR")
+    set (component_header SuiteSparseQR.hpp)
+  else (component STREQUAL "SPQR")
+    set (component_header ${component_library}.h)
+  endif (component STREQUAL "Config")
+
+  suitesparse_find_component(${component}
+    FILES ${component_header}
+    LIBRARIES ${component_library})
+endforeach (component IN LISTS SuiteSparse_FIND_COMPONENTS)
+
+if (TARGET SuiteSparse::SPQR)
   # SuiteSparseQR may be compiled with Intel Threading Building Blocks,
   # we assume that if TBB is installed, SuiteSparseQR was compiled with
   # support for it, this will do no harm if it wasn't.
-  find_package(TBB QUIET)
+  find_package(TBB QUIET NO_MODULE)
   if (TBB_FOUND)
     message(STATUS "Found Intel Thread Building Blocks (TBB) library "
-      "(${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} / ${TBB_INTERFACE_VERSION}) "
-      "include location: ${TBB_INCLUDE_DIRS}. Assuming SuiteSparseQR was "
-      "compiled with TBB.")
+      "(${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} / ${TBB_INTERFACE_VERSION}). "
+      "Assuming SuiteSparseQR was compiled with TBB.")
     # Add the TBB libraries to the SuiteSparseQR libraries (the only
     # libraries to optionally depend on TBB).
-    list(APPEND SUITESPARSEQR_LIBRARY ${TBB_LIBRARIES})
-  else()
+    set_property (TARGET SuiteSparse::SPQR APPEND PROPERTY
+      INTERFACE_LINK_LIBRARIES TBB::tbb)
+  else (TBB_FOUND)
     message(STATUS "Did not find Intel TBB library, assuming SuiteSparseQR was "
       "not compiled with TBB.")
-  endif()
-endif(SUITESPARSEQR_FOUND)
+  endif (TBB_FOUND)
+endif (TARGET SuiteSparse::SPQR)
 
-# UFconfig / SuiteSparse_config.
-#
-# If SuiteSparse version is >= 4 then SuiteSparse_config is required.
-# For SuiteSparse 3, UFconfig.h is required.
-suitesparse_find_component(
-  SUITESPARSE_CONFIG FILES SuiteSparse_config.h LIBRARIES suitesparseconfig)
+check_library_exists(rt shm_open "" HAVE_LIBRT)
 
-if (SUITESPARSE_CONFIG_FOUND)
+if (TARGET SuiteSparse::Config)
   # SuiteSparse_config (SuiteSparse version >= 4) requires librt library for
   # timing by default when compiled on Linux or Unix, but not on OSX (which
   # does not have librt).
-  if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
-    suitesparse_find_component(LIBRT LIBRARIES rt)
-    if (LIBRT_FOUND)
-      message(STATUS "Adding librt: ${LIBRT_LIBRARY} to "
-        "SuiteSparse_config libraries (required on Linux & Unix [not OSX] if "
-        "SuiteSparse is compiled with timing).")
-      list(APPEND SUITESPARSE_CONFIG_LIBRARY ${LIBRT_LIBRARY})
-    else()
-      message(STATUS "Could not find librt, but found SuiteSparse_config, "
-        "assuming that SuiteSparse was compiled without timing.")
-    endif ()
-  endif (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
-else()
-  # Failed to find SuiteSparse_config (>= v4 installs), instead look for
-  # UFconfig header which should be present in < v4 installs.
-  suitesparse_find_component(UFCONFIG FILES UFconfig.h)
-endif ()
+  if (HAVE_LIBRT)
+    message(STATUS "Adding librt to "
+      "SuiteSparse_config libraries (required on Linux & Unix [not OSX] if "
+      "SuiteSparse is compiled with timing).")
+    set_property (TARGET SuiteSparse::Config APPEND PROPERTY
+      INTERFACE_LINK_LIBRARIES $<LINK_ONLY:rt>)
+  else (HAVE_LIBRT)
+    message(STATUS "Could not find librt, but found SuiteSparse_config, "
+      "assuming that SuiteSparse was compiled without timing.")
+  endif (HAVE_LIBRT)
 
-if (NOT SUITESPARSE_CONFIG_FOUND AND
-    NOT UFCONFIG_FOUND)
-  suitesparse_report_not_found(
-    "Failed to find either: SuiteSparse_config header & library (should be "
-    "present in all SuiteSparse >= v4 installs), or UFconfig header (should "
-    "be present in all SuiteSparse < v4 installs).")
-endif()
+  # Add BLAS and LAPACK as dependencies of SuiteSparse::Config for convenience
+  # given that all components depend on it.
+  if (BLAS_FOUND)
+    if (TARGET BLAS::BLAS)
+      set_property (TARGET SuiteSparse::Config APPEND PROPERTY
+        INTERFACE_LINK_LIBRARIES $<LINK_ONLY:BLAS::BLAS>)
+    else (TARGET BLAS::BLAS)
+      set_property (TARGET SuiteSparse::Config APPEND PROPERTY
+        INTERFACE_LINK_LIBRARIES ${BLAS_LIBRARIES})
+    endif (TARGET BLAS::BLAS)
+  endif (BLAS_FOUND)
 
-# Extract the SuiteSparse version from the appropriate header (UFconfig.h for
-# <= v3, SuiteSparse_config.h for >= v4).
-list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSE_VERSION)
+  if (LAPACK_FOUND)
+    if (TARGET LAPACK::LAPACK)
+      set_property (TARGET SuiteSparse::Config APPEND PROPERTY
+        INTERFACE_LINK_LIBRARIES $<LINK_ONLY:LAPACK::LAPACK>)
+    else (TARGET LAPACK::LAPACK)
+      set_property (TARGET SuiteSparse::Config APPEND PROPERTY
+        INTERFACE_LINK_LIBRARIES ${LAPACK_LIBRARIES})
+    endif (TARGET LAPACK::LAPACK)
+  endif (LAPACK_FOUND)
 
-if (UFCONFIG_FOUND)
-  # SuiteSparse version <= 3.
-  set(SUITESPARSE_VERSION_FILE ${UFCONFIG_INCLUDE_DIR}/UFconfig.h)
-  if (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
-    suitesparse_report_not_found(
-      "Could not find file: ${SUITESPARSE_VERSION_FILE} containing version "
-      "information for <= v3 SuiteSparse installs, but UFconfig was found "
-      "(only present in <= v3 installs).")
-  else (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
-    file(READ ${SUITESPARSE_VERSION_FILE} UFCONFIG_CONTENTS)
-
-    string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
-      SUITESPARSE_MAIN_VERSION "${UFCONFIG_CONTENTS}")
-    string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
-      SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
-
-    string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
-      SUITESPARSE_SUB_VERSION "${UFCONFIG_CONTENTS}")
-    string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
-      SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
-
-    string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
-      SUITESPARSE_SUBSUB_VERSION "${UFCONFIG_CONTENTS}")
-    string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
-      SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_VERSION}")
-
-    # This is on a single line s/t CMake does not interpret it as a list of
-    # elements and insert ';' separators which would result in 4.;2.;1 nonsense.
-    set(SUITESPARSE_VERSION
-      "${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}")
-  endif (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
-endif (UFCONFIG_FOUND)
-
-if (SUITESPARSE_CONFIG_FOUND)
   # SuiteSparse version >= 4.
-  set(SUITESPARSE_VERSION_FILE
-    ${SUITESPARSE_CONFIG_INCLUDE_DIR}/SuiteSparse_config.h)
-  if (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
+  set(SuiteSparse_VERSION_FILE
+    ${SuiteSparse_Config_INCLUDE_DIR}/SuiteSparse_config.h)
+  if (NOT EXISTS ${SuiteSparse_VERSION_FILE})
     suitesparse_report_not_found(
-      "Could not find file: ${SUITESPARSE_VERSION_FILE} containing version "
+      "Could not find file: ${SuiteSparse_VERSION_FILE} containing version "
       "information for >= v4 SuiteSparse installs, but SuiteSparse_config was "
       "found (only present in >= v4 installs).")
-  else (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
-    file(READ ${SUITESPARSE_VERSION_FILE} SUITESPARSE_CONFIG_CONTENTS)
+  else (NOT EXISTS ${SuiteSparse_VERSION_FILE})
+    file(READ ${SuiteSparse_VERSION_FILE} Config_CONTENTS)
 
-    string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
-      SUITESPARSE_MAIN_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
-    string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
-      SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
+    string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION[ \t]+([0-9]+)"
+      SuiteSparse_VERSION_LINE "${Config_CONTENTS}")
+    set (SuiteSparse_VERSION_MAJOR ${CMAKE_MATCH_1})
 
-    string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
-      SUITESPARSE_SUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
-    string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
-      SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
+    string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION[ \t]+([0-9]+)"
+      SuiteSparse_VERSION_LINE "${Config_CONTENTS}")
+    set (SuiteSparse_VERSION_MINOR ${CMAKE_MATCH_1})
 
-    string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
-      SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
-    string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
-      SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_VERSION}")
+    string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION[ \t]+([0-9]+)"
+      SuiteSparse_VERSION_LINE "${Config_CONTENTS}")
+    set (SuiteSparse_VERSION_PATCH ${CMAKE_MATCH_1})
+
+    unset (SuiteSparse_VERSION_LINE)
 
     # This is on a single line s/t CMake does not interpret it as a list of
     # elements and insert ';' separators which would result in 4.;2.;1 nonsense.
-    set(SUITESPARSE_VERSION
-      "${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}")
-  endif (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
-endif (SUITESPARSE_CONFIG_FOUND)
+    set(SuiteSparse_VERSION
+      "${SuiteSparse_VERSION_MAJOR}.${SuiteSparse_VERSION_MINOR}.${SuiteSparse_VERSION_PATCH}")
 
-# METIS (Optional dependency).
-suitesparse_find_component(METIS LIBRARIES metis)
+    if (SuiteSparse_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+      set(SuiteSparse_VERSION_COMPONENTS 3)
+    else (SuiteSparse_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+      message (WARNING "Could not parse SuiteSparse_config.h: SuiteSparse "
+        "version will not be available")
 
-# Only mark SuiteSparse as found if all required components and dependencies
-# have been found.
-set(SUITESPARSE_FOUND TRUE)
-foreach(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
-  if (NOT ${REQUIRED_VAR})
-    set(SUITESPARSE_FOUND FALSE)
-  endif (NOT ${REQUIRED_VAR})
-endforeach(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
+      unset (SuiteSparse_VERSION)
+      unset (SuiteSparse_VERSION_MAJOR)
+      unset (SuiteSparse_VERSION_MINOR)
+      unset (SuiteSparse_VERSION_PATCH)
+    endif (SuiteSparse_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+  endif (NOT EXISTS ${SuiteSparse_VERSION_FILE})
+endif (TARGET SuiteSparse::Config)
 
-if (SUITESPARSE_FOUND)
-  list(APPEND SUITESPARSE_INCLUDE_DIRS
-    ${AMD_INCLUDE_DIR}
-    ${CAMD_INCLUDE_DIR}
-    ${COLAMD_INCLUDE_DIR}
-    ${CCOLAMD_INCLUDE_DIR}
-    ${CHOLMOD_INCLUDE_DIR}
-    ${SUITESPARSEQR_INCLUDE_DIR})
-  # Handle config separately, as otherwise at least one of them will be set
-  # to NOTFOUND which would cause any check on SUITESPARSE_INCLUDE_DIRS to fail.
-  if (SUITESPARSE_CONFIG_FOUND)
-    list(APPEND SUITESPARSE_INCLUDE_DIRS
-      ${SUITESPARSE_CONFIG_INCLUDE_DIR})
-  endif (SUITESPARSE_CONFIG_FOUND)
-  if (UFCONFIG_FOUND)
-    list(APPEND SUITESPARSE_INCLUDE_DIRS
-      ${UFCONFIG_INCLUDE_DIR})
-  endif (UFCONFIG_FOUND)
-  # As SuiteSparse includes are often all in the same directory, remove any
-  # repetitions.
-  list(REMOVE_DUPLICATES SUITESPARSE_INCLUDE_DIRS)
+# CHOLMOD requires AMD CAMD CCOLAMD COLAMD
+if (TARGET SuiteSparse::CHOLMOD)
+  foreach (component IN ITEMS AMD CAMD CCOLAMD COLAMD)
+    if (TARGET SuiteSparse::${component})
+      set_property (TARGET SuiteSparse::CHOLMOD APPEND PROPERTY
+        INTERFACE_LINK_LIBRARIES SuiteSparse::${component})
+    else (TARGET SuiteSparse::${component})
+      # Consider CHOLMOD not found if COLAMD cannot be found
+      set (SuiteSparse_CHOLMOD_FOUND FALSE)
+    endif (TARGET SuiteSparse::${component})
+  endforeach (component IN ITEMS AMD CAMD CCOLAMD COLAMD)
+endif (TARGET SuiteSparse::CHOLMOD)
 
-  # Important: The ordering of these libraries is *NOT* arbitrary, as these
-  # could potentially be static libraries their link ordering is important.
-  list(APPEND SUITESPARSE_LIBRARIES
-    ${SUITESPARSEQR_LIBRARY}
-    ${CHOLMOD_LIBRARY}
-    ${CCOLAMD_LIBRARY}
-    ${CAMD_LIBRARY}
-    ${COLAMD_LIBRARY}
-    ${AMD_LIBRARY}
-    ${LAPACK_LIBRARIES}
-    ${BLAS_LIBRARIES})
-  if (SUITESPARSE_CONFIG_FOUND)
-    list(APPEND SUITESPARSE_LIBRARIES
-      ${SUITESPARSE_CONFIG_LIBRARY})
-  endif (SUITESPARSE_CONFIG_FOUND)
-  if (METIS_FOUND)
-    list(APPEND SUITESPARSE_LIBRARIES
-      ${METIS_LIBRARY})
-  endif (METIS_FOUND)
-endif()
+# SPQR requires CHOLMOD
+if (TARGET SuiteSparse::SPQR)
+  if (TARGET SuiteSparse::CHOLMOD)
+    set_property (TARGET SuiteSparse::SPQR APPEND PROPERTY
+      INTERFACE_LINK_LIBRARIES SuiteSparse::CHOLMOD)
+  else (TARGET SuiteSparse::CHOLMOD)
+    # Consider SPQR not found if CHOLMOD cannot be found
+    set (SuiteSparse_SQPR_FOUND FALSE)
+  endif (TARGET SuiteSparse::CHOLMOD)
+endif (TARGET SuiteSparse::SPQR)
 
-# Determine if we are running on Ubuntu with the package install of SuiteSparse
-# which is broken and does not support linking a shared library.
-set(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION FALSE)
-if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
-    SUITESPARSE_VERSION VERSION_EQUAL 3.4.0)
-  find_program(LSB_RELEASE_EXECUTABLE lsb_release)
-  if (LSB_RELEASE_EXECUTABLE)
-    # Any even moderately recent Ubuntu release (likely to be affected by
-    # this bug) should have lsb_release, if it isn't present we are likely
-    # on a different Linux distribution (should be fine).
-    execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -si
-      OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
+# Add SuiteSparse::Config as dependency to all components
+if (TARGET SuiteSparse::Config)
+  foreach (component IN LISTS SuiteSparse_FIND_COMPONENTS)
+    if (component STREQUAL Config)
+      continue ()
+    endif (component STREQUAL Config)
 
-    if (LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
-        SUITESPARSE_LIBRARIES MATCHES "/usr/lib/libamd")
-      # We are on Ubuntu, and the SuiteSparse version matches the broken
-      # system install version and is a system install.
-      set(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION TRUE)
-      message(STATUS "Found system install of SuiteSparse "
-        "${SUITESPARSE_VERSION} running on Ubuntu, which has a known bug "
-        "preventing linking of shared libraries (static linking unaffected).")
-    endif (LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
-      SUITESPARSE_LIBRARIES MATCHES "/usr/lib/libamd")
-  endif (LSB_RELEASE_EXECUTABLE)
-endif (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
-  SUITESPARSE_VERSION VERSION_EQUAL 3.4.0)
+    if (TARGET SuiteSparse::${component})
+      set_property (TARGET SuiteSparse::${component} APPEND PROPERTY
+        INTERFACE_LINK_LIBRARIES SuiteSparse::Config)
+    endif (TARGET SuiteSparse::${component})
+  endforeach (component IN LISTS SuiteSparse_FIND_COMPONENTS)
+endif (TARGET SuiteSparse::Config)
+
+# Check whether CHOLMOD was compiled with METIS support. The check can be
+# performed only after the main components have been set up.
+if (TARGET SuiteSparse::CHOLMOD)
+  # NOTE If SuiteSparse was compiled as a static library we'll need to link
+  # against METIS already during the check. Otherwise, the check can fail due to
+  # undefined references even though SuiteSparse was compiled with METIS.
+  find_package (METIS)
+
+  if (TARGET METIS::METIS)
+    cmake_push_check_state (RESET)
+    set (CMAKE_REQUIRED_LIBRARIES SuiteSparse::CHOLMOD METIS::METIS)
+    check_symbol_exists (cholmod_metis cholmod.h SuiteSparse_CHOLMOD_USES_METIS)
+    cmake_pop_check_state ()
+
+    if (SuiteSparse_CHOLMOD_USES_METIS)
+      set_property (TARGET SuiteSparse::CHOLMOD APPEND PROPERTY
+        INTERFACE_LINK_LIBRARIES $<LINK_ONLY:METIS::METIS>)
+
+      # Provide the SuiteSparse::Partition component whose availability indicates
+      # that CHOLMOD was compiled with the Partition module.
+      if (NOT TARGET SuiteSparse::Partition)
+        add_library (SuiteSparse::Partition IMPORTED INTERFACE)
+      endif (NOT TARGET SuiteSparse::Partition)
+
+      set_property (TARGET SuiteSparse::Partition APPEND PROPERTY
+        INTERFACE_LINK_LIBRARIES SuiteSparse::CHOLMOD)
+    endif (SuiteSparse_CHOLMOD_USES_METIS)
+  endif (TARGET METIS::METIS)
+endif (TARGET SuiteSparse::CHOLMOD)
+
+# We do not use suitesparse_find_component to find Partition and therefore must
+# handle the availability in an extra step.
+if (TARGET SuiteSparse::Partition)
+  set (SuiteSparse_Partition_FOUND TRUE)
+else (TARGET SuiteSparse::Partition)
+  set (SuiteSparse_Partition_FOUND FALSE)
+endif (TARGET SuiteSparse::Partition)
 
 suitesparse_reset_find_library_prefix()
 
 # Handle REQUIRED and QUIET arguments to FIND_PACKAGE
 include(FindPackageHandleStandardArgs)
-if (SUITESPARSE_FOUND)
+if (SuiteSparse_FOUND)
   find_package_handle_standard_args(SuiteSparse
-    REQUIRED_VARS ${SUITESPARSE_FOUND_REQUIRED_VARS}
-    VERSION_VAR SUITESPARSE_VERSION
-    FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse.")
-else (SUITESPARSE_FOUND)
+    REQUIRED_VARS ${SuiteSparse_REQUIRED_VARS}
+    VERSION_VAR SuiteSparse_VERSION
+    FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse."
+    HANDLE_COMPONENTS)
+else (SuiteSparse_FOUND)
   # Do not pass VERSION_VAR to FindPackageHandleStandardArgs() if we failed to
   # find SuiteSparse to avoid a confusing autogenerated failure message
   # that states 'not found (missing: FOO) (found version: x.y.z)'.
   find_package_handle_standard_args(SuiteSparse
-    REQUIRED_VARS ${SUITESPARSE_FOUND_REQUIRED_VARS}
-    FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse.")
-endif (SUITESPARSE_FOUND)
+    REQUIRED_VARS ${SuiteSparse_REQUIRED_VARS}
+    FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse."
+    HANDLE_COMPONENTS)
+endif (SuiteSparse_FOUND)
+
+# Pop CMP0057.
+cmake_policy (POP)
diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake
deleted file mode 100644
index 5ae7b61..0000000
--- a/cmake/FindTBB.cmake
+++ /dev/null
@@ -1,455 +0,0 @@
-# - Find ThreadingBuildingBlocks include dirs and libraries
-# Use this module by invoking find_package with the form:
-#  find_package(TBB
-#    [REQUIRED]             # Fail with error if TBB is not found
-#    )                      #
-# Once done, this will define
-#
-#  TBB_FOUND - system has TBB
-#  TBB_INCLUDE_DIRS - the TBB include directories
-#  TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or
-#                  malloc proxy
-#  TBB::tbb - imported target for the TBB library
-#
-#  TBB_VERSION_MAJOR - Major Product Version Number
-#  TBB_VERSION_MINOR - Minor Product Version Number
-#  TBB_INTERFACE_VERSION - Engineering Focused Version Number
-#  TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version
-#                                     still supported. This uses the engineering
-#                                     focused interface version numbers.
-#
-#  TBB_MALLOC_FOUND - system has TBB malloc library
-#  TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories
-#  TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined
-#  TBB::malloc - imported target for the TBB malloc library
-#
-#  TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library
-#  TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories
-#  TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined
-#  TBB::malloc_proxy - imported target for the TBB malloc proxy library
-#
-#
-# This module reads hints about search locations from variables:
-#  ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds
-#  ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation
-#  ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb
-#                         libraries. Should be specified with ENV TBB_ROOT
-#                         and optionally...
-#  ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build
-#
-#
-# Modified by Robert Maynard from the original OGRE source
-#
-#-------------------------------------------------------------------
-# This file is part of the CMake build system for OGRE
-#     (Object-oriented Graphics Rendering Engine)
-# For the latest info, see http://www.ogre3d.org/
-#
-# The contents of this file are placed in the public domain. Feel
-# free to make use of it in any way you like.
-#-------------------------------------------------------------------
-#
-# =========================================================================
-# Taken from Copyright.txt in the root of the VTK source tree as per
-# instructions to substitute the full license in place of the summary
-# reference when distributing outside of VTK
-# =========================================================================
-#
-#  Program:   Visualization Toolkit
-#  Module:    Copyright.txt
-#
-# Copyright (c) 1993-2015 Ken Martin, Will Schroeder, Bill Lorensen
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-#
-# * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
-#   of any contributors may be used to endorse or promote products derived
-#   from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
-# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# =========================================================================*/
-
-#=============================================================================
-#  FindTBB helper functions and macros
-#
-
-#====================================================
-# Fix the library path in case it is a linker script
-#====================================================
-function(tbb_extract_real_library library real_library)
-  if(NOT UNIX OR NOT EXISTS ${library})
-    set(${real_library} "${library}" PARENT_SCOPE)
-    return()
-  endif()
-
-  #Read in the first 4 bytes and see if they are the ELF magic number
-  set(_elf_magic "7f454c46")
-  file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX)
-  if(_hex_data STREQUAL _elf_magic)
-    #we have opened a elf binary so this is what
-    #we should link to
-    set(${real_library} "${library}" PARENT_SCOPE)
-    return()
-  endif()
-
-  file(READ ${library} _data OFFSET 0 LIMIT 1024)
-  if("${_data}" MATCHES "INPUT \\(([^(]+)\\)")
-    #extract out the .so name from REGEX MATCH command
-    set(_proper_so_name "${CMAKE_MATCH_1}")
-
-    #construct path to the real .so which is presumed to be in the same directory
-    #as the input file
-    get_filename_component(_so_dir "${library}" DIRECTORY)
-    set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE)
-  else()
-    #unable to determine what this library is so just hope everything works
-    #and pass it unmodified.
-    set(${real_library} "${library}" PARENT_SCOPE)
-  endif()
-endfunction()
-
-#===============================================
-# Do the final processing for the package find.
-#===============================================
-macro(findpkg_finish PREFIX TARGET_NAME)
-  if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
-    set(${PREFIX}_FOUND TRUE)
-    set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
-    set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
-  else ()
-    if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY)
-      message(FATAL_ERROR "Required library ${PREFIX} not found.")
-    endif ()
-  endif ()
-
-  if (NOT TARGET "TBB::${TARGET_NAME}")
-    if (${PREFIX}_LIBRARY_RELEASE)
-      tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release)
-    endif ()
-    if (${PREFIX}_LIBRARY_DEBUG)
-      tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug)
-    endif ()
-    add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED)
-    set_target_properties(TBB::${TARGET_NAME} PROPERTIES
-      INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}")
-    if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE)
-      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
-        IMPORTED_LOCATION "${real_release}"
-        IMPORTED_LOCATION_DEBUG "${real_debug}"
-        IMPORTED_LOCATION_RELEASE "${real_release}")
-    elseif (${PREFIX}_LIBRARY_RELEASE)
-      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
-        IMPORTED_LOCATION "${real_release}")
-    elseif (${PREFIX}_LIBRARY_DEBUG)
-      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
-        IMPORTED_LOCATION "${real_debug}")
-    endif ()
-  endif ()
-
-  #mark the following variables as internal variables
-  mark_as_advanced(${PREFIX}_INCLUDE_DIR
-                   ${PREFIX}_LIBRARY
-                   ${PREFIX}_LIBRARY_DEBUG
-                   ${PREFIX}_LIBRARY_RELEASE)
-endmacro()
-
-#===============================================
-# Generate debug names from given release names
-#===============================================
-macro(get_debug_names PREFIX)
-  foreach(i ${${PREFIX}})
-    set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
-  endforeach()
-endmacro()
-
-#===============================================
-# See if we have env vars to help us find tbb
-#===============================================
-macro(getenv_path VAR)
-   set(ENV_${VAR} $ENV{${VAR}})
-   # replace won't work if var is blank
-   if (ENV_${VAR})
-     string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
-   endif ()
-endmacro()
-
-#===============================================
-# Couple a set of release AND debug libraries
-#===============================================
-macro(make_library_set PREFIX)
-  if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
-    set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG})
-  elseif (${PREFIX}_RELEASE)
-    set(${PREFIX} ${${PREFIX}_RELEASE})
-  elseif (${PREFIX}_DEBUG)
-    set(${PREFIX} ${${PREFIX}_DEBUG})
-  endif ()
-endmacro()
-
-#===============================================
-# Ensure that the release & debug libraries found are from the same installation.
-#===============================================
-macro(find_tbb_library_verifying_release_debug_locations PREFIX)
-  find_library(${PREFIX}_RELEASE
-    NAMES ${${PREFIX}_NAMES}
-    HINTS ${TBB_LIB_SEARCH_PATH})
-  if (${PREFIX}_RELEASE)
-    # To avoid finding a mismatched set of release & debug libraries from
-    # different installations if the first found does not have debug libraries
-    # by forcing the search for debug to only occur within the detected release
-    # library directory (if found).  Although this would break detection if the
-    # release & debug libraries were shipped in different directories, this is
-    # not the case in the official TBB releases for any platform.
-    get_filename_component(
-      FOUND_RELEASE_LIB_DIR "${${PREFIX}_RELEASE}" DIRECTORY)
-    find_library(${PREFIX}_DEBUG
-      NAMES ${${PREFIX}_NAMES_DEBUG}
-      HINTS ${FOUND_RELEASE_LIB_DIR}
-      NO_DEFAULT_PATH)
-  else()
-    find_library(${PREFIX}_DEBUG
-      NAMES ${${PREFIX}_NAMES_DEBUG}
-      HINTS ${TBB_LIB_SEARCH_PATH})
-  endif()
-endmacro()
-
-#=============================================================================
-#  Now to actually find TBB
-#
-
-# Get path, convert backslashes as ${ENV_${var}}
-getenv_path(TBB_ROOT)
-
-# initialize search paths
-set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT})
-set(TBB_INC_SEARCH_PATH "")
-set(TBB_LIB_SEARCH_PATH "")
-
-
-# If user built from sources
-set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})
-if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT)
-  getenv_path(TBB_BUILD_DIR)
-  if (NOT ENV_TBB_BUILD_DIR)
-    set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build)
-  endif ()
-
-  # include directory under ${ENV_TBB_ROOT}/include
-  list(APPEND TBB_LIB_SEARCH_PATH
-    ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release
-    ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug)
-endif ()
-
-
-# For Windows, let's assume that the user might be using the precompiled
-# TBB packages from the main website. These use a rather awkward directory
-# structure (at least for automatically finding the right files) depending
-# on platform and compiler, but we'll do our best to accommodate it.
-# Not adding the same effort for the precompiled linux builds, though. Those
-# have different versions for CC compiler versions and linux kernels which
-# will never adequately match the user's setup, so there is no feasible way
-# to detect the "best" version to use. The user will have to manually
-# select the right files. (Chances are the distributions are shipping their
-# custom version of tbb, anyway, so the problem is probably nonexistent.)
-if (WIN32 AND MSVC)
-  set(COMPILER_PREFIX "vc7.1")
-  if (MSVC_VERSION EQUAL 1400)
-    set(COMPILER_PREFIX "vc8")
-  elseif(MSVC_VERSION EQUAL 1500)
-    set(COMPILER_PREFIX "vc9")
-  elseif(MSVC_VERSION EQUAL 1600)
-    set(COMPILER_PREFIX "vc10")
-  elseif(MSVC_VERSION EQUAL 1700)
-    set(COMPILER_PREFIX "vc11")
-  elseif(MSVC_VERSION EQUAL 1800)
-    set(COMPILER_PREFIX "vc12")
-  elseif(MSVC_VERSION GREATER_EQUAL 1900)
-    set(COMPILER_PREFIX "vc14")
-  endif ()
-
-  # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
-  foreach (dir IN LISTS TBB_PREFIX_PATH)
-    if (CMAKE_CL_64)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
-    else ()
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
-    endif ()
-  endforeach ()
-endif ()
-
-# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
-# and above and AppleClang
-if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
-    NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
-  set (USE_LIBCXX OFF)
-  cmake_policy(GET CMP0025 POLICY_VAR)
-
-  if (POLICY_VAR STREQUAL "NEW")
-    if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
-      set (USE_LIBCXX ON)
-    endif ()
-  else ()
-    if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
-      set (USE_LIBCXX ON)
-    endif ()
-  endif ()
-
-  if (USE_LIBCXX)
-    foreach (dir IN LISTS TBB_PREFIX_PATH)
-      list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
-    endforeach ()
-  endif ()
-endif ()
-
-# check compiler ABI
-if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-  set(COMPILER_PREFIX)
-  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
-    list(APPEND COMPILER_PREFIX "gcc4.8")
-  endif()
-  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
-    list(APPEND COMPILER_PREFIX "gcc4.7")
-  endif()
-  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
-    list(APPEND COMPILER_PREFIX "gcc4.4")
-  endif()
-  list(APPEND COMPILER_PREFIX "gcc4.1")
-elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-  set(COMPILER_PREFIX)
-  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess
-    list(APPEND COMPILER_PREFIX "gcc4.8")
-  endif()
-  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
-    list(APPEND COMPILER_PREFIX "gcc4.7")
-  endif()
-  list(APPEND COMPILER_PREFIX "gcc4.4")
-else() # Assume compatibility with 4.4 for other compilers
-  list(APPEND COMPILER_PREFIX "gcc4.4")
-endif ()
-
-# if platform architecture is explicitly specified
-set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
-if (TBB_ARCH_PLATFORM)
-  foreach (dir IN LISTS TBB_PREFIX_PATH)
-    list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
-    list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
-  endforeach ()
-endif ()
-
-foreach (dir IN LISTS TBB_PREFIX_PATH)
-  foreach (prefix IN LISTS COMPILER_PREFIX)
-    if (CMAKE_SIZEOF_VOID_P EQUAL 8)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix})
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib)
-    else ()
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix})
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
-      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib)
-    endif ()
-  endforeach()
-endforeach ()
-
-# add general search paths
-foreach (dir IN LISTS TBB_PREFIX_PATH)
-  list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb
-    ${dir}/Libs)
-  list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include
-    ${dir}/include/tbb)
-endforeach ()
-
-set(TBB_LIBRARY_NAMES tbb)
-get_debug_names(TBB_LIBRARY_NAMES)
-
-find_path(TBB_INCLUDE_DIR
-          NAMES tbb/tbb.h
-          HINTS ${TBB_INC_SEARCH_PATH})
-find_tbb_library_verifying_release_debug_locations(TBB_LIBRARY)
-make_library_set(TBB_LIBRARY)
-
-findpkg_finish(TBB tbb)
-
-#if we haven't found TBB no point on going any further
-if (NOT TBB_FOUND)
-  return()
-endif ()
-
-#=============================================================================
-# Look for TBB's malloc package
-set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)
-get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
-
-find_path(TBB_MALLOC_INCLUDE_DIR
-          NAMES tbb/tbb.h
-          HINTS ${TBB_INC_SEARCH_PATH})
-find_tbb_library_verifying_release_debug_locations(TBB_MALLOC_LIBRARY)
-make_library_set(TBB_MALLOC_LIBRARY)
-
-findpkg_finish(TBB_MALLOC tbbmalloc)
-
-#=============================================================================
-# Look for TBB's malloc proxy package
-set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy)
-get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
-
-find_path(TBB_MALLOC_PROXY_INCLUDE_DIR
-          NAMES tbb/tbbmalloc_proxy.h
-          HINTS ${TBB_INC_SEARCH_PATH})
-find_tbb_library_verifying_release_debug_locations(TBB_MALLOC_PROXY_LIBRARY)
-make_library_set(TBB_MALLOC_PROXY_LIBRARY)
-
-findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
-
-
-#=============================================================================
-#parse all the version numbers from tbb
-if(NOT TBB_VERSION)
-
- #only read the start of the file
- file(STRINGS
-      "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"
-      TBB_VERSION_CONTENTS
-      REGEX "VERSION")
-
-  string(REGEX REPLACE
-    ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
-    TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}")
-
-  string(REGEX REPLACE
-    ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
-    TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}")
-
-  string(REGEX REPLACE
-        ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
-        TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
-
-  string(REGEX REPLACE
-        ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
-        TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
-
-endif()
diff --git a/cmake/PrettyPrintCMakeList.cmake b/cmake/PrettyPrintCMakeList.cmake
index 067883c..30151fe 100644
--- a/cmake/PrettyPrintCMakeList.cmake
+++ b/cmake/PrettyPrintCMakeList.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2018 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/ReadCeresVersionFromSource.cmake b/cmake/ReadCeresVersionFromSource.cmake
index 2859744..53e29c4 100644
--- a/cmake/ReadCeresVersionFromSource.cmake
+++ b/cmake/ReadCeresVersionFromSource.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/UpdateCacheVariable.cmake b/cmake/UpdateCacheVariable.cmake
index 82ae571..bf3b594 100644
--- a/cmake/UpdateCacheVariable.cmake
+++ b/cmake/UpdateCacheVariable.cmake
@@ -1,5 +1,5 @@
 # Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
+# Copyright 2023 Google Inc. All rights reserved.
 # http://ceres-solver.org/
 #
 # Redistribution and use in source and binary forms, with or without
diff --git a/cmake/config.h.in b/cmake/config.h.in
index 4a516f6..1566795 100644
--- a/cmake/config.h.in
+++ b/cmake/config.h.in
@@ -1,5 +1,5 @@
 // Ceres Solver - A fast non-linear least squares minimizer
-// Copyright 2015 Google Inc. All rights reserved.
+// Copyright 2022 Google Inc. All rights reserved.
 // http://ceres-solver.org/
 //
 // Redistribution and use in source and binary forms, with or without
@@ -50,15 +50,14 @@
 // If defined, Ceres was compiled without SuiteSparse.
 @CERES_NO_SUITESPARSE@
 
-// If defined, Ceres was compiled without CXSparse.
-@CERES_NO_CXSPARSE@
+// If defined, Ceres was compiled without CUDA.
+@CERES_NO_CUDA@
 
 // If defined, Ceres was compiled without Apple's Accelerate framework solvers.
 @CERES_NO_ACCELERATE_SPARSE@
 
 #if defined(CERES_NO_SUITESPARSE) &&              \
     defined(CERES_NO_ACCELERATE_SPARSE) &&        \
-    defined(CERES_NO_CXSPARSE) &&                 \
     !defined(CERES_USE_EIGEN_SPARSE)  // NOLINT
 // If defined Ceres was compiled without any sparse linear algebra support.
 #define CERES_NO_SPARSE
@@ -71,19 +70,26 @@
 // routines.
 @CERES_NO_CUSTOM_BLAS@
 
-// If defined, Ceres was compiled without multithreading support.
-@CERES_NO_THREADS@
-// If defined Ceres was compiled with OpenMP multithreading.
-@CERES_USE_OPENMP@
-// If defined Ceres was compiled with modern C++ multithreading.
-@CERES_USE_CXX_THREADS@
+// If defined, Ceres was compiled with a version of SuiteSparse/CHOLMOD without
+// the Partition module (requires METIS).
+@CERES_NO_CHOLMOD_PARTITION@
+// If defined Ceres was compiled without support for METIS via Eigen.
+@CERES_NO_EIGEN_METIS@
 
-// If defined, Ceres was built as a shared library.
-@CERES_USING_SHARED_LIBRARY@
 
-// If defined, Ceres was compiled with a version MSVC >= 2005 which
-// deprecated the standard POSIX names for bessel functions, replacing them
-// with underscore prefixed versions (e.g. j0() -> _j0()).
-@CERES_MSVC_USE_UNDERSCORE_PREFIXED_BESSEL_FUNCTIONS@
+// CERES_NO_SPARSE should be automatically defined by config.h if Ceres was
+// compiled without any sparse back-end.  Verify that it has not subsequently
+// been inconsistently redefined.
+#if defined(CERES_NO_SPARSE)
+#if !defined(CERES_NO_SUITESPARSE)
+#error CERES_NO_SPARSE requires CERES_NO_SUITESPARSE.
+#endif
+#if !defined(CERES_NO_ACCELERATE_SPARSE)
+#error CERES_NO_SPARSE requires CERES_NO_ACCELERATE_SPARSE
+#endif
+#if defined(CERES_USE_EIGEN_SPARSE)
+#error CERES_NO_SPARSE requires !CERES_USE_EIGEN_SPARSE
+#endif
+#endif
 
 #endif  // CERES_PUBLIC_INTERNAL_CONFIG_H_
diff --git a/cmake/iOS.cmake b/cmake/iOS.cmake
index 4029f96..0773d13 100644
--- a/cmake/iOS.cmake
+++ b/cmake/iOS.cmake
@@ -257,7 +257,7 @@
 
 set(CMAKE_C_FLAGS
   "${XCODE_IOS_PLATFORM_VERSION_FLAGS} -fobjc-abi-version=2 -fobjc-arc ${CMAKE_C_FLAGS}")
-# Hidden visibilty is required for C++ on iOS.
+# Hidden visibility is required for C++ on iOS.
 set(CMAKE_CXX_FLAGS
   "${XCODE_IOS_PLATFORM_VERSION_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc ${CMAKE_CXX_FLAGS}")
 set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math ${CMAKE_CXX_FLAGS_RELEASE}")
@@ -309,7 +309,7 @@
   ${CMAKE_OSX_SYSROOT}/Developer/Library/Frameworks)
 
 # Only search the specified iOS SDK, not the remainder of the host filesystem.
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
@@ -322,7 +322,6 @@
 
 # This macro lets you find executable programs on the host system.
 macro(find_host_package)
-  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
   set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
   set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
   set(IOS FALSE)
@@ -330,7 +329,6 @@
   find_package(${ARGN})
 
   set(IOS TRUE)
-  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
   set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
   set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 endmacro(find_host_package)