GTEST_VERSION="${GTEST_VERSION#gtest-}"
GTEST_VERSION="${GTEST_VERSION#googletest-}"
- # If the GTEST_VERSION is still not correct semver, we need to determine googletest version in other way.
- # Let's try to extract it from CMake build script used by Google Test starting from version 1.8.0.
posix_regex=$(expr "5" : "\([[:digit:]]\)")
- if test "$posix_regex" = "5" ; then
+ if test "${posix_regex}" = "5" ; then
semver_regex='[^[:digit:]]\{0,\}\([[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\).\{0,\}'
- AC_MSG_NOTICE([posix regex used])
else
semver_regex='[[^0-9]]\{0,\}\([[0-9]]\{1,\}\.[[0-9]]\{1,\}\.[[0-9]]\{1,\}\).\{0,\}'
- AC_MSG_NOTICE([non posix regex used])
fi
+
gtest_version_candidate=
gtest_version_candidate=$(expr "$GTEST_VERSION" : "$semver_regex")
gtest_version_found="no"
if test -z "$gtest_version_candidate" ; then
+ # If the GTEST_VERSION is still not correct semver, we need to determine googletest version in other way.
+ # Let's try to extract it from CMake build script used by Google Test starting from version 1.8.0.
if test -f "$cmakelists" ; then
- AC_MSG_NOTICE([CMakeLists.txt found $cmakelists])
gtest_version_line=$($AWK '/set\(GOOGLETEST_VERSION/ { print }' "$cmakelists")
- AC_MSG_NOTICE([gtest_version_line $gtest_version_line])
gtest_version_candidate=$(expr "$gtest_version_line" : "$semver_regex")
- AC_MSG_NOTICE([gtest_version_candidate $gtest_version_candidate])
if test -n "$gtest_version_candidate"; then
gtest_version_found="yes"
GTEST_VERSION=$gtest_version_candidate
fi
if test $gtest_version_found = "no" ; then
+ AC_MSG_WARN([Could not find GTEST version])
GTEST_VERSION="unknown"
fi
fi