#!/bin/sh
# NOTE: this is a simple script wrapper around the cmake command line
# tools, for those used to the autotools configure script conventions
if ! which cmake > /dev/null; then
echo "ERROR: You need the 'cmake' program to configure the build process."
echo "Please install 'cmake' first, then try again."
exit 1
fi
print_help()
{
echo "This is a simple configure script wrapper around cmake build system."
echo "Parameters are:"
echo " --prefix=<path> Set the install prefix to path"
echo " --enable-debug Enable debug (non-optimized) build"
echo " --disable-color-make Disable color output for Makefiles"
echo
echo "Please run cmake directly for full control over the build."
echo
}
cmake_args=""
build_type="Release"
while [ $# -gt 0 ]
do
preq=${1%=*} # get part before =
case $preq
in
--help)
print_help
exit 0
;;
--prefix)
prefix=${1##*=} # get part after =
cmake_args="$cmake_cmd -DCMAKE_INSTALL_PREFIX:PATH=$prefix"
;;
--enable-debug)
build_type="Debug"
cmake_args="$cmake_args -DCMAKE_BUILD_TYPE:STRING=Debug"
;;
--disable-debug)
build_type="Release"
cmake_args="$cmake_args -DCMAKE_BUILD_TYPE:STRING=Release"
;;
--enable-color-make)
cmake_args="$cmake_args -DCMAKE_COLOR_MAKEFILE:BOOL=1"
;;
--disable-color-make)
cmake_args="$cmake_args -DCMAKE_COLOR_MAKEFILE:BOOL=0"
;;
*)
echo "Invalid argument: $preq"
echo "Run $0 --help for a list of valid parameters."
exit 2
;;
esac
shift 1
done
cmake `dirname $0` $cmake_args || exit 1
echo
echo "Now you must type: make; make install"
echo "to actually build and install the software"
echo