Support user passing a custom CMAKE_MODULE_PATH (for BLAS / LAPACK).
- Previously we set CMAKE_MODULE_PATH explicitly rather than appending
to it when adding our local cmake directory.
- This meant the user could not easily pass their own directory which
would also be used. This would be useful if they had their own
custom FindBLAS / FindLAPACK scripts that they wanted to overload
the defaults shipped with CMake.
Change-Id: I0c1fda1b6fd81eab68755aa036f64af3efbb226d
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f157c2f..fba40ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,8 +64,10 @@
ENDIF (NOT EXISTS ${LOCAL_GIT_DIRECTORY}/hooks/commit-msg)
ENDIF (EXISTS ${LOCAL_GIT_DIRECTORY})
-# Make CMake aware of the cmake folder for local FindXXX scripts.
-SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
+# Make CMake aware of the cmake folder for local FindXXX scripts,
+# append rather than set in case the user has passed their own
+# additional paths via -D.
+LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
INCLUDE(UpdateCacheVariable)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
diff --git a/docs/source/building.rst b/docs/source/building.rst
index bba4ec1..e37d504 100644
--- a/docs/source/building.rst
+++ b/docs/source/building.rst
@@ -480,6 +480,20 @@
are always visible in the *Advanced View*. They can also be
set directly via ``-D<VAR>=<VALUE>`` arguments to ``CMake``.
+Building using custom BLAS & LAPACK installs
+----------------------------------------------
+
+If you are building on an exotic system, then the standard find package
+scripts for ``BLAS`` & ``LAPACK`` which ship with ``CMake`` might not
+work. In this case, one option would be to write your own custom versions for
+your environment and then set ``CMAKE_MODULE_PATH`` to the directory
+containing these custom scripts when invoking ``CMake`` to build Ceres and they
+will be used in preference to the default versions. However, in order for this
+to work, your scripts must provide the full set of variables provided by the
+default scripts. Also, if you are building Ceres with ``SuiteSparse``, the
+versions of ``BLAS`` & ``LAPACK`` used by ``SuiteSparse`` and Ceres should be
+the same.
+
.. _section-using-ceres:
Using Ceres with CMake