summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-12-16 15:56:47 (GMT)
committerBrad King <brad.king@kitware.com>2011-12-16 16:32:45 (GMT)
commitf39e82c9d5b2d8fe46da8c5d422fb9db550d3626 (patch)
treee537a36b4609fc563d0e761dc85306317906ff9d /bootstrap
parentdbf05f75c3406a03fc912d3d90949972f2bcfd07 (diff)
downloadCMake-f39e82c9d5b2d8fe46da8c5d422fb9db550d3626.zip
CMake-f39e82c9d5b2d8fe46da8c5d422fb9db550d3626.tar.gz
CMake-f39e82c9d5b2d8fe46da8c5d422fb9db550d3626.tar.bz2
bootstrap: Re-implement command line option processing
Use POSIX shell features to shorten and simplify bootstrap command-line option processing.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap85
1 files changed, 28 insertions, 57 deletions
diff --git a/bootstrap b/bootstrap
index 1431c3f..0ad212b7 100755
--- a/bootstrap
+++ b/bootstrap
@@ -11,6 +11,10 @@
# See the License for more information.
#=============================================================================
+die() {
+ echo "$@" 1>&2 ; exit 1
+}
+
# Version number extraction function.
cmake_version_component()
{
@@ -527,63 +531,30 @@ cmake_verbose=
cmake_parallel_make=
cmake_ccache_enabled=
cmake_prefix_dir="${cmake_default_prefix}"
-for a in "$@"; do
- if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
- cmake_prefix_dir=`echo $a | sed "s/^--prefix=//"`
- cmake_prefix_dir=`cmake_fix_slashes "${cmake_prefix_dir}"`
- fi
- if echo $a | grep "^--parallel=" > /dev/null 2> /dev/null; then
- cmake_parallel_make=`echo $a | sed "s/^--parallel=//" | grep "[0-9][0-9]*"`
- fi
- if echo $a | grep "^--datadir=" > /dev/null 2> /dev/null; then
- cmake_data_dir=`echo $a | sed "s/^--datadir=//"`
- fi
- if echo $a | grep "^--docdir=" > /dev/null 2> /dev/null; then
- cmake_doc_dir=`echo $a | sed "s/^--docdir=//"`
- fi
- if echo $a | grep "^--mandir=" > /dev/null 2> /dev/null; then
- cmake_man_dir=`echo $a | sed "s/^--mandir=//"`
- fi
- if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then
- cmake_init_file=`echo $a | sed "s/^--init=//"`
- fi
- for lib in bzip2 curl expat libarchive zlib; do
- if echo $a | grep "^--system-${lib}" > /dev/null 2> /dev/null; then
- cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper ${lib}`=1"
- break
- elif echo $a | grep "^--no-system-${lib}" > /dev/null 2> /dev/null; then
- cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper ${lib}`=0"
- break
- fi
- done
- if echo $a | grep "^--system-libs" > /dev/null 2> /dev/null; then
- cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1"
- fi
- if echo $a | grep "^--no-system-libs" > /dev/null 2> /dev/null; then
- cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0"
- fi
- if echo $a | grep "^--qt-gui" > /dev/null 2> /dev/null; then
- cmake_bootstrap_qt_gui="1"
- fi
- if echo $a | grep "^--no-qt-gui" > /dev/null 2> /dev/null; then
- cmake_bootstrap_qt_gui="0"
- fi
- if echo $a | grep "^--qt-qmake=" > /dev/null 2> /dev/null; then
- cmake_bootstrap_qt_qmake=`echo $a | sed "s/^--qt-qmake=//"`
- fi
- if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
- cmake_usage
- fi
- if echo $a | grep "^--version" > /dev/null 2> /dev/null; then
- cmake_version_display
- exit 2
- fi
- if echo $a | grep "^--verbose" > /dev/null 2> /dev/null; then
- cmake_verbose=TRUE
- fi
- if echo $a | grep "^--enable-ccache" > /dev/null 2> /dev/null; then
- cmake_ccache_enabled=TRUE
- fi
+while test $# != 0; do
+ case "$1" in
+ --prefix=*) cmake_prefix_dir=`cmake_fix_slashes "${1#*=}"` ;;
+ --parallel=*) cmake_parallel_make="${1#*=}" ;;
+ --datadir=*) cmake_data_dir="${1#*=}" ;;
+ --docdir=*) cmake_doc_dir="${1#*=}" ;;
+ --mandir=*) cmake_man_dir="${1#*=}" ;;
+ --init=*) cmake_init_file="${1#*=}" ;;
+ --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
+ --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
+ --system-bzip2|--system-curl|--system-expat|--system-libarchive|--system-zlib)
+ cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper ${1#--system-}`=1" ;;
+ --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-libarchive|--no-system-zlib)
+ cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper ${1#--no-system-}`=0" ;;
+ --qt-gui) cmake_bootstrap_qt_gui="1" ;;
+ --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
+ --qt-qmake=*) cmake_bootstrap_qt_qmake="${1#*=}" ;;
+ --help) cmake_usage ;;
+ --version) cmake_version_display ; exit 2 ;;
+ --verbose) cmake_verbose=TRUE ;;
+ --enable-ccache) cmake_ccache_enabled=TRUE ;;
+ *) die "Unknown option: $1" ;;
+ esac
+ shift
done
# If verbose, display some information about bootstrap