Skip to content

Commit

Permalink
build.sh: allow for arbitrary cmake configuration options after --
Browse files Browse the repository at this point in the history
  • Loading branch information
edgomez committed Mar 9, 2023
1 parent 6a15974 commit 8a47c1b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DO_CONFIG=1
DO_BUILD=1
DO_INSTALL=0
SUDO=""
CMAKE_OPTIONS_FROM_CMDLINE=""

PRINT_HELP=0

Expand Down Expand Up @@ -120,6 +121,10 @@ parse_args()
-h|--help)
PRINT_HELP=1
;;
--)
shift
CMAKE_OPTIONS_FROM_CMDLINE="$@"
;;
*)
echo "warning: ignoring unknown option $option"
;;
Expand All @@ -135,7 +140,7 @@ parse_args()
print_help()
{
cat <<EOF
$(basename $0) [OPTIONS]
$(basename $0) [OPTIONS] [-- [additional cmake configuration options...]]
Options:
Installation:
Expand Down Expand Up @@ -170,6 +175,9 @@ Cleanup actions:
-f --force Force clean-build to perform removal
ignoring any errors
Additional cmake configuration options:
Options passed as is to the cmake configure command
Features:
By default cmake will enable the features it autodetects on the build machine.
Specifying the option on the command line forces the feature on or off.
Expand Down Expand Up @@ -362,7 +370,7 @@ if [ $ADDRESS_SANITIZER -ne 0 ] ; then
fi


cmd_config="${ASAN_FLAGS}cmake -G \"$BUILD_GENERATOR\" -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${CMAKE_MORE_OPTIONS} \"$DT_SRC_DIR\""
cmd_config="${ASAN_FLAGS}cmake -G \"$BUILD_GENERATOR\" -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${CMAKE_MORE_OPTIONS} ${CMAKE_OPTIONS_FROM_CMDLINE} \"$DT_SRC_DIR\""
cmd_build="cmake --build "$BUILD_DIR" -- -j$MAKE_TASKS"
cmd_install="${SUDO}cmake --build \"$BUILD_DIR\" --target install -- -j$MAKE_TASKS"

Expand Down

0 comments on commit 8a47c1b

Please sign in to comment.