klips/scripts/cmake-build.sh

28 lines
749 B
Bash
Raw Normal View History

#!/bin/bash
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
## A custom bash script for building cmake projects. ##
## Intended to be ran in root directory of the project alongside CMakeLists ##
###############################################################################
# Infinite while loop - break on conditions
while true
do
printf "\nEnter 1 to build, 2 to cleanup previous build, 0 to exit.\n"
read bChoice
2019-07-28 05:16:23 +00:00
if [ $bChoice -eq 1 ] # Build project
then
mkdir build
(cd build && cmake .. && cmake --build .)
2019-07-28 05:16:23 +00:00
elif [ $bChoice -eq 2 ] ; then # Cleanup build
rm -Rv build/*
2019-07-28 05:16:23 +00:00
elif [ $bChoice -eq 0 ] ; then # Exit script
break
2019-07-28 05:16:23 +00:00
else
continue
fi
2019-07-28 05:16:23 +00:00
done