Do not discard caller's CMAKE_MODULE_PATH

Ceres CMake package configuration relies on several own find modules
(e.g., for SuiteSparse and METIS). To allow CMake to discover additional
find modules, the CMAKE_MODULE_PATH variable must be updated to include
the directories containing the corresponding find modules.

Previously, before updating CMAKE_MODULE_PATH, Ceres stored the
variable's initial value and then completely replaced it by the
directory containing Ceres's modules. However, a find_dependency failure
would cause an early return preventing CMAKE_MODULE_PATH to be restored.
Thus, any initial user changes to CMAKE_MODULE_PATH would be lost.

Now, instead of completely replacing the CMAKE_MODULE_PATH value we only
prepend additional directories. An early return no longer has a
destructive effect on CMAKE_MODULE_PATH. In a failure case,
CMAKE_MODULE_PATH still contains caller's initial set of directories and
an additional path prepended by Ceres.

Fixes #1024

Change-Id: I80d92a5dff9f3cff651f950c4f8d04ece008b44b
1 file changed
tree: 2b022e21df6ec7e03bde35979bb235c363ca165c
  1. .github/
  2. bazel/
  3. cmake/
  4. config/
  5. data/
  6. docs/
  7. examples/
  8. include/
  9. internal/
  10. scripts/
  11. third_party/
  12. .clang-format
  13. .gitignore
  14. .gitmodules
  15. .readthedocs.yaml
  16. BUILD
  17. CITATION.cff
  18. CMakeLists.txt
  19. CONTRIBUTING.md
  20. LICENSE
  21. MODULE.bazel
  22. package.xml
  23. README.md
  24. WORKSPACE
README.md

Android Linux macOS Windows

Ceres Solver

Ceres Solver is an open source C++ library for modeling and solving large, complicated optimization problems. It is a feature rich, mature and performant library which has been used in production at Google since 2010. Ceres Solver can solve two kinds of problems.

  1. Non-linear Least Squares problems with bounds constraints.
  2. General unconstrained optimization problems.

Please see ceres-solver.org for more information.