diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 31d8d8b663f5f..b976f5fdc6cf1 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -48,17 +48,9 @@ check_prereqs() { echo "Checking prerequisites..." - # Check presence of CMake on the path - command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; } - - function version { echo "$@" | awk -F. '{ printf("%d%02d%02d\n", $1,$2,$3); }'; } - - local cmakeRequiredMinimumVersion="3.14.5" - local cmakeInstalledVersion="$(cmake --version | awk '/^cmake.* version [0-9]+\.[0-9]+\.[0-9]+$/ {print $3}')" - - if [[ "$(version "$cmakeInstalledVersion")" -lt "$(version "$cmakeRequiredMinimumVersion")" ]]; then - echo "Found cmake v$cmakeInstalledVersion in PATH. Please install v$cmakeRequiredMinimumVersion or newer from https://www.cmake.org/download/." - exit 1; + if ! cmake --help 2>&1 | grep -q \\-B; then + echo "Please install cmake v3.14.5 or newer from https://www.cmake.org/download/." + exit 1 fi if [[ "$__HostOS" == "OSX" ]]; then