co-maps/tools/autobuild/detect_cmake.sh
2025-11-22 13:58:55 +01:00

16 lines
306 B
Bash
Executable file

#!/usr/bin/env bash
set -e -u
# If CMAKE variable is set, use it
[ -n "${CMAKE-}" -a -x "${CMAKE-}" ] && return 0
# Find cmake, prefer cmake3
for name in cmake3 cmake; do
if command -v "$name" > /dev/null; then
CMAKE="$name"
return 0
fi
done
echo 'Error: cmake is not installed.' >&2
exit 1