Skip to content

Commit

Permalink
Enhance build.sh to support passing CMake arguments
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Nov 4, 2024
1 parent 558703e commit 7d357d7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ set -e
builddir="cmake/"

# Parse arguments
# If the first argument starts in "-D", we pass it to CMake
if [[ "${1}" == "-D"* ]]; then
cmake_args="${1}"
shift
fi

# Parse the remaining arguments
for var in "$@"
do
case "${var}" in
Expand All @@ -35,7 +42,7 @@ do
esac
done

# Display help text
# Display help text if requested
if [[ -n "${help}" ]]; then
cat << EOF
Usage: $0 [options]
Expand Down Expand Up @@ -144,8 +151,8 @@ fi
# ./build.sh "-DA=1 -DB=2" install
mkdir -p "${builddir}"
cd "${builddir}"
if [[ "${1}" == "-D"* ]]; then
cmake "${1}" ..
if [[ -n ${cmake_args} ]]; then
cmake "${cmake_args}" ..
else
cmake ..
fi
Expand Down

0 comments on commit 7d357d7

Please sign in to comment.