ENH: Add better error reporting

This commit is contained in:
Andy Cedilnik 2003-05-14 09:19:12 -04:00
parent cbef9d224d
commit df7ae80a21
1 changed files with 50 additions and 40 deletions

View File

@ -49,39 +49,19 @@ EOF
exit 10 exit 10
} }
cmake_verbose= cmake_error()
cmake_prefix_dir="/usr/local" {
for a in "$@"; do
if echo $a | grep "^--prefix="; then
cmake_prefix_dir=`echo $a | sed "s/^--prefix=//"`
fi
if echo $a | grep "^--help"; then
cmake_usage
fi
if echo $a | grep "^--verbose"; then
cmake_verbose=TRUE
fi
done
if [ -n "${cmake_verbose}" ]; then
echo "---------------------------------------------" echo "---------------------------------------------"
echo "Source directory: ${cmake_source_dir}" echo "Error when bootstrapping CMake:"
echo "Binary directory: ${cmake_binary_dir}" echo "$*"
echo "Prefix directory: ${cmake_prefix_dir}" echo "---------------------------------------------"
echo "System: ${cmake_system}" if [ -f cmake_bootstrap.log ]; then
fi echo "Log of errors:"
cat cmake_bootstrap.log
echo "---------------------------------------------" echo "---------------------------------------------"
fi
[ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}" exit 1
if [ ! -d "${cmake_bootstrap_dir}" ]; then }
echo "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
exit 5
fi
cd "${cmake_bootstrap_dir}"
rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
rm -f "${cmake_bootstrap_dir}/cmConfigure.h"
cmake_report () cmake_report ()
{ {
@ -160,6 +140,39 @@ cmake_try_make ()
return 0 return 0
} }
cmake_verbose=
cmake_prefix_dir="/usr/local"
for a in "$@"; do
if echo $a | grep "^--prefix="; then
cmake_prefix_dir=`echo $a | sed "s/^--prefix=//"`
fi
if echo $a | grep "^--help"; then
cmake_usage
fi
if echo $a | grep "^--verbose"; then
cmake_verbose=TRUE
fi
done
if [ -n "${cmake_verbose}" ]; then
echo "---------------------------------------------"
echo "Source directory: ${cmake_source_dir}"
echo "Binary directory: ${cmake_binary_dir}"
echo "Prefix directory: ${cmake_prefix_dir}"
echo "System: ${cmake_system}"
fi
echo "---------------------------------------------"
[ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
if [ ! -d "${cmake_bootstrap_dir}" ]; then
cmake_error "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
fi
cd "${cmake_bootstrap_dir}"
rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
rm -f "${cmake_bootstrap_dir}/cmConfigure.h"
cmake_c_flags=${CFLAGS} cmake_c_flags=${CFLAGS}
cmake_cxx_flags=${CXXFLAGS} cmake_cxx_flags=${CXXFLAGS}
@ -189,9 +202,8 @@ done
rm -f "${TMPFILE}.c" rm -f "${TMPFILE}.c"
if [ -z "${cmake_c_compiler}" ]; then if [ -z "${cmake_c_compiler}" ]; then
echo "Cannot find apropriate C compiler on this system." cmake_error "Cannot find apropriate C compiler on this system.
echo "Please specify one using environment variable CC." Please specify one using environment variable CC."
exit 1
fi fi
echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}" echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
@ -222,9 +234,8 @@ rm -f "${TMPFILE}.cxx"
if [ -z "${cmake_cxx_compiler}" ]; then if [ -z "${cmake_cxx_compiler}" ]; then
echo "Cannot find apropriate C++ compiler on this system." cmake_error "Cannot find apropriate C++ compiler on this system.
echo "Please specify one using environment variable CXX." Please specify one using environment variable CXX."
exit 1
fi fi
echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}" echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
@ -351,8 +362,7 @@ echo "---------------------------------------------"
${cmake_make_processor} ${cmake_make_processor}
RES=$? RES=$?
if [ "${RES}" -ne "0" ]; then if [ "${RES}" -ne "0" ]; then
echo "Problem while bootstrapping CMake" cmake_error "Problem while bootstrapping CMake"
exit 8
fi fi
cd "${cmake_binary_dir}" cd "${cmake_binary_dir}"
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}"