#!/bin/bash -e

SRCDIR=`dirname $0`
BUILDDIR="$SRCDIR/build"

mkdir -p "$BUILDDIR"

if hash cmake3 2>/dev/null; then
    # CentOS users are encouraged to install cmake3 from EPEL
    CMAKE=cmake3
else
    CMAKE=cmake
fi

cd "$BUILDDIR"

$CMAKE ${EXTRA_CMAKE_FLAGS:-} ..
make
