-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_and_run.sh
executable file
·59 lines (42 loc) · 1.1 KB
/
build_and_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#Zero 0 value is success
# Change to the current directory
cd "$(dirname "$0")"
# Create a build directory if it doesn't exist
mkdir -p build
# Change to the build directory
cd build
# Clean the build directory
rm -rf *
# Run the cmake command
cmake ..
# Capture the return value
return_value=$?
# Check the return value
if [ $return_value -ne 0 ]; then
echo "CMake command failed with exit status $return_value."
exit $return_value
fi
# Continue script execution if cmake command succeeds
echo "CMake command executed successfully."
# Build the project
make
# Capture the return value
return_value=$?
# Check the return value
if [ $return_value -ne 0 ]; then
echo "Make command failed with exit status $return_value."
exit $return_value
fi
# Continue script execution if make command succeeds
echo "Make command executed successfully."
# Run the project if the build was successful
cd ..
./bin/Debug/uuid_lic
# Capture the return value
return_value=$?
# Check the return value
if [ $return_value -ne 0 ]; then
echo "Program failed with status $return_value."
exit $return_value
fi