Newer
Older
* C++ compiler: ${cmake_cxx_compiler}
* C++ flags: ${cmake_cxx_flags}
*
* Make: ${cmake_make_processor}
*
* Sources:
* ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
* kwSys Sources:
* ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}
*/
"
cmake_report cmConfigure.h.tmp "${cmake_compiler_settings_comment}"
if [ "x$KWSYS_STL_HAVE_STD" = "x1" ]; then
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_STD_NAMESPACE */"
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "#define CMAKE_NO_STD_NAMESPACE 1"
if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */"
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_STREAM_HEADERS 1"
if [ "x$KWSYS_IOS_USE_SSTREAM" = "x1" ]; then
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_STRING_STREAM */"
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_STRING_STREAM 1"
# Test for ansi FOR scope
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags}" \
"${cmake_source_dir}/Modules/TestForAnsiForScope.cxx" >> cmake_bootstrap.log 2>&1; then
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "/* #undef CMAKE_NO_ANSI_FOR_SCOPE */"
echo "${cmake_cxx_compiler} has ANSI for scoping"
else
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "#define CMAKE_NO_ANSI_FOR_SCOPE 1"
echo "${cmake_cxx_compiler} does not have ANSI for scoping"
fi
# Write CMake version
CMake_VERSION=`cat "${cmake_source_dir}/CMakeLists.txt" | \
grep "SET(CMake_VERSION_${a} *[0-9]*)" | sed "s/SET(CMake_VERSION_${a} *\([0-9]*\))/\1/"`
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "#define CMake_VERSION_${a} ${CMake_VERSION}"
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "#define CMAKE_ROOT_DIR \"${cmake_source_dir}\""
cmake_report cmConfigure.h.tmp "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
Andy Cedilnik
committed
cmake_report cmConfigure.h.tmp "#define CMAKE_BOOTSTRAP"
# Regenerate real cmConfigure.h
if diff cmConfigure.h cmConfigure.h.tmp > /dev/null 2> /dev/null; then
rm -f cmConfigure.h.tmp
else
mv -f cmConfigure.h.tmp cmConfigure.h
fi
cmake_kwsys_config_replace_string \
"${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
"${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
"${cmake_compiler_settings_comment}"
cmake_kwsys_config_replace_string \
"${cmake_source_dir}/Source/kwsys/Configure.h.in" \
"${cmake_bootstrap_dir}/cmsys/Configure.h" \
"${cmake_compiler_settings_comment}"
for a in ${KWSYS_FILES}; do
cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
"${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
done
for a in ${KWSYS_IOS_FILES}; do
cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_ios_${a}.h.in" \
"${cmake_bootstrap_dir}/cmsys/ios/${a}" KWSYS_NAMESPACE cmsys
cmake_replace_string "${cmake_source_dir}/Source/kwsys/kwsys_stl.hxx.in" \
"${cmake_bootstrap_dir}/cmsys/stl/stl.hxx.in" KWSYS_STL_HEADER_EXTRA ""
cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.hxx.in" \
"${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" KWSYS_NAMESPACE cmsys
cmake_replace_string "${cmake_bootstrap_dir}/cmsys/stl/stl.h.in" \
"${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
dep="cmConfigure.h cmsys/Configure.hxx cmsys/Configure.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_GENERATED_SOURCES}; do
Andy Cedilnik
committed
# Generate dependencies for cmBootstrapCommands.cxx
for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
done
cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
Andy Cedilnik
committed
if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
fi
if [ "x${cmake_c_flags}" != "x" ]; then
cmake_c_flags="${cmake_c_flags} "
fi
Andy Cedilnik
committed
if [ "x${cmake_cxx_flags}" != "x" ]; then
cmake_cxx_flags="${cmake_cxx_flags} "
fi
cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
-I`cmake_escape \"${cmake_bootstrap_dir}\"`"
cmake_cxx_flags="${cmake_cxx_flags}-I`cmake_escape \"${cmake_source_dir}/Source\"` \
-I`cmake_escape \"${cmake_bootstrap_dir}\"`"
echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${LDFLAGS} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
for a in ${CMAKE_CXX_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
Brad King
committed
echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
for a in ${CMAKE_C_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
for a in ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
for a in ${KWSYS_CXX_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
Brad King
committed
echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
if ${cmake_system_mingw}; then
src=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9xEnc.c"`
in=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9x.exe"`
cmd=`cmake_escape "${cmake_bootstrap_dir}/cmsysEncodeExecutable.exe"`
a="cmsysProcessFwd9xEnc"
echo "${cmd} : EncodeExecutable.o" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${LDFLAGS} ${cmake_c_flags} EncodeExecutable.o -o ${cmd}" >> "${cmake_bootstrap_dir}/Makefile"
echo "${in} : ProcessFwd9x.o" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${LDFLAGS} ${cmake_c_flags} ProcessFwd9x.o -o ${in}" >> "${cmake_bootstrap_dir}/Makefile"
echo "${src} : ${cmd} ${in}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmd} ${in} ${src} cmsys ProcessFwd9x" >> "${cmake_bootstrap_dir}/Makefile"
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -I`cmake_escape \"${cmake_source_dir}/Source/kwsys\"` -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
fi
cat>>"${cmake_bootstrap_dir}/Makefile"<<EOF
rebuild_cache:
cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
EOF
# Write our default settings to Bootstrap.cmk/InitialCacheFlags.cmake.
cat > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" <<EOF
# Generated by ${cmake_source_dir}/bootstrap
# Default cmake settings. These may be overridden any settings below.
SET (CMAKE_INSTALL_PREFIX "${cmake_prefix_dir}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
SET (CMAKE_DOC_DIR "${cmake_doc_dir}" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
SET (CMAKE_MAN_DIR "${cmake_man_dir}" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
SET (CMAKE_DATA_DIR "${cmake_data_dir}" CACHE PATH "Install location for data (relative to prefix)." FORCE)
EOF
# Add user-specified settings. Handle relative-path case for
# specification of cmake_init_file.
(
cd "${cmake_binary_dir}"
if [ -f "${cmake_init_file}" ]; then
cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
fi
)
echo "---------------------------------------------"
# Run make to build bootstrap cmake
Andy Cedilnik
committed
if [ "x${cmake_parallel_make}" != "x" ]; then
${cmake_make_processor} ${cmake_make_flags}
Andy Cedilnik
committed
else
${cmake_make_processor}
fi
RES=$?
if [ "${RES}" -ne "0" ]; then
cmake_error 9 "Problem while running ${cmake_make_processor}"
# Set C, CXX, and MAKE environment variables, so that real real cmake will be
# build with same compiler and make
CC="${cmake_c_compiler}"
CXX="${cmake_cxx_compiler}"
MAKE="${cmake_make_processor}"
export CC
export CXX
export MAKE
# Run bootstrap CMake to configure real CMake
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}"
RES=$?
if [ "${RES}" -ne "0" ]; then
cmake_error 11 "Problem while running initial CMake"
fi
echo "---------------------------------------------"
# And we are done. Now just run make
echo "CMake has bootstrapped. Now run ${cmake_make_processor}."