#!/bin/sh
set -e

SRCDIR="$(dirname "$0")/cmake-smoke"
BUILDDIR="$(mktemp -d)"
trap 'rm -rf "$BUILDDIR"' EXIT

echo "Configuring CMake smoke test..."
cmake -S "$SRCDIR" -B "$BUILDDIR"

echo "Building CMake smoke test..."
cmake --build "$BUILDDIR"

echo "Running smoke test binary..."
"$BUILDDIR/smoke_test"

echo "CMake smoke test passed."
