summaryrefslogtreecommitdiffstats
path: root/CMake/run_if_exists.sh
blob: 97edd4c1a43f22b78b354aa33a4fcb7b446cf56d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
# Small helper for running a command
out=""
if [ "$1" = "--stdout" ]; then
    out="$2"
    shift 2
fi

if [ -e "$1" ]; then
    shift
    if [ "$out" ]; then
        exec "$@" > $out
    else
        exec "$@"
    fi
fi