-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathpreset.sh
More file actions
executable file
·48 lines (42 loc) · 889 Bytes
/
Copy pathpreset.sh
File metadata and controls
executable file
·48 lines (42 loc) · 889 Bytes
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
#!/bin/bash
print_usage() {
echo "Usage: $0 <preset> [static|shared] [release|debug] [gcc|clang]"
}
# Required: preset name
PRESET="$1"
shift
if [[ -z "$PRESET" ]]; then
echo "Error: Missing required <preset>"
print_usage
exit 1
fi
# Build the command
CMD=(cmake --preset "$PRESET")
# Parse remaining args (position-insensitive)
for arg in "$@"; do
case "$arg" in
static)
CMD+=("-DBUILD_SHARED_LIBS=OFF")
;;
shared)
CMD+=("-DBUILD_SHARED_LIBS=ON")
;;
release|debug)
CMD+=("-DCMAKE_BUILD_TYPE="$arg"")
;;
gcc)
CMD+=("-DCMAKE_C_COMPILER=gcc")
CMD+=("-DCMAKE_CXX_COMPILER=g++")
;;
clang)
CMD+=("-DCMAKE_C_COMPILER=clang")
CMD+=("-DCMAKE_CXX_COMPILER=clang++")
;;
*)
# Add directly into the command line
CMD+=("$arg")
;;
esac
done
# Run the command
"${CMD[@]}"