Make CERES_EIGEN_VERSION macro independent of CMake.
CERES_EIGEN_VERSION was being defined by the CMakeList.txt file
but it is needed by the android build too. So this change
directly constructs the CERES_EIGEN_VERSION string out of the
raw Eigen version numbers.
Change-Id: I65309805a59076c3082141d9042ab7e0e1b972bc
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
index 962d231..6cac9c9 100644
--- a/internal/ceres/CMakeLists.txt
+++ b/internal/ceres/CMakeLists.txt
@@ -132,9 +132,6 @@
# Also depend on the header files so that they appear in IDEs.
FILE(GLOB CERES_INTERNAL_HDRS *.h)
-# Define version information for use in Solver::FullReport.
-ADD_DEFINITIONS(-DCERES_EIGEN_VERSION="${EIGEN_VERSION}")
-
# Include the specialized schur solvers.
IF (SCHUR_SPECIALIZATIONS)
FILE(GLOB CERES_INTERNAL_SCHUR_FILES generated/*.cc)
diff --git a/internal/ceres/solver_utils.cc b/internal/ceres/solver_utils.cc
index 8b3bae9..7f4ff7e 100644
--- a/internal/ceres/solver_utils.cc
+++ b/internal/ceres/solver_utils.cc
@@ -30,6 +30,7 @@
#include <string>
+#include "Eigen/Core"
#include "ceres/internal/port.h"
#include "ceres/solver_utils.h"
#include "ceres/version.h"
@@ -37,9 +38,13 @@
namespace ceres {
namespace internal {
+#define CERES_EIGEN_VERSION \
+ CERES_TO_STRING(EIGEN_WORLD_VERSION) "." \
+ CERES_TO_STRING(EIGEN_MAJOR_VERSION) "." \
+ CERES_TO_STRING(EIGEN_MINOR_VERSION)
+
std::string VersionString() {
std::string value = std::string(CERES_VERSION_STRING);
-
value += "-eigen-(" + std::string(CERES_EIGEN_VERSION) + ")";
#ifdef CERES_NO_LAPACK