#! /bin/bash
# shellcheck disable=SC2154

if ! command -v otsb_cmd_configure > /dev/null; then

    otsb_cmd_configure () (

	[ -d build ] || mkdir build
	cd build || exit 1

	if otsb_is_set default-config-opt
	then
	    cmake				\
		"${default_config_opt[@]}"	\
		"${config_opt[@]}"		\
		..
	else
	    cmake					\
		"-DCMAKE_INSTALL_PREFIX=$exec_prefix"	\
		"${config_opt[@]}"			\
		..
	fi
    )

    _otsb_configure_options () {
	otsb_add_option array  config-opt 'extra options for cmake; may be specified multiple times'
    }

    otsb_hook_push_fn_back options_before _otsb_configure_options
fi
