sc3dev/cmake-build-and-test.sh

23 lines
591 B
Bash
Executable File

#!/usr/bin/env bash
######################################################################
# @author : kyle (kyleimap.cc)
# @file : setup-cmake
# @created : Wednesday Oct 18, 2023 04:24:21 PDT
#
# @description : Prepare a CMake build environment, build, and test.
######################################################################
set -eux
BUILD_TYPE="${BUILD_TYPE:-Debug}"
if [ "${USE_CLANG:-}" == "yes" ]
then
export CC=$(command -v clang)
export CXX=$(command -v clang++)
fi
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. && make all test