Ensure CMakeLists.txt and include versions match.

This causes the release script to abort if the
Ceres version in the headers, command line,
and CMake files don't match.

Change-Id: I38c4f1b4ebf3499d2ba4f698fa3f4936538c3de7
This commit is contained in:
Keir Mierle
2012-09-11 18:04:09 -07:00
parent 6da1f87a6b
commit 7e73d1020f
+26 -2
View File
@@ -47,11 +47,35 @@ VERSION=$(grep 'SET(CERES_VERSION' CMakeLists.txt | \
ABI_VERSION=$(grep 'SET(CERES_ABI_VERSION' CMakeLists.txt | \ ABI_VERSION=$(grep 'SET(CERES_ABI_VERSION' CMakeLists.txt | \
sed -e 's/SET(CERES_ABI_VERSION //' | \ sed -e 's/SET(CERES_ABI_VERSION //' | \
sed -e 's/)//') sed -e 's/)//')
VERSION_IN_HEADER=$(grep '#define CERES_VERSION' include/ceres/ceres.h | \
sed -e 's/#define CERES_VERSION //')
ABI_VERSION_IN_HEADER=$(grep '#define CERES_ABI_VERSION' \
include/ceres/ceres.h | \
sed -e 's/#define CERES_ABI_VERSION //')
GIT_COMMIT=$(git log -1 HEAD |grep commit) GIT_COMMIT=$(git log -1 HEAD |grep commit)
if [[ $1 != $VERSION ]] ; then if [[ $1 != $VERSION ]] ; then
echo "ERROR: Version $1 does not match CERES_VERSION in CMakeLists.txt." echo "ERROR: Version from the command line $1 does not match CERES_VERSION"
echo " which is $VERSION. You may not be in the toplevel source dir." echo " in CMakeLists.txt, which is $VERSION. You may not be in the "
echo " toplevel source dir."
exit 1
fi
if [[ $VERSION_IN_HEADER != $VERSION ]] ; then
echo "ERROR: CERES_VERSION version from include/ceres/ceres.h, which is"
echo " $VERSION_IN_HEADER, does not match the ABI version"
echo " from the toplevel CMakeLists.txt, which is $ABI_VERSION."
echo " You may not be in the toplevel source directory, or the"
echo " versions are out of sync."
exit 1
fi
if [[ $ABI_VERSION_IN_HEADER != $ABI_VERSION ]] ; then
echo "ERROR: CERES_ABI_VERSION from include/ceres/ceres.h, which is"
echo " $ABI_VERSION_IN_HEADER, does not match the ABI version"
echo " from the toplevel CMakeLists.txt, which is $ABI_VERSION."
echo " You may not be in the toplevel source directory, or the"
echo " versions are out of sync."
exit 1 exit 1
fi fi