2 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
3 # file Copyright.txt or https://cmake.org/licensing for details.
6 echo "$@" 1>&2 ; exit 1
9 # Compile flag extraction function.
10 cmake_extract_standard_flags()
12 cd "${cmake_source_dir}/Modules/Compiler/"
13 for file in ${1:-*}-${2}.cmake; do
15 | sed -n "s/ *set *( *CMAKE_${2}${3}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
20 # Version number extraction function.
21 cmake_version_component()
23 cat "${cmake_source_dir}/Source/CMakeVersion.cmake" | sed -n "
24 /^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
28 # Install destination extraction function.
29 cmake_install_dest_default()
31 cat "${cmake_source_dir}/Source/CMakeInstallDestinations.cmake" | sed -n '
32 /^ *set(CMAKE_'"${1}"'_DIR_DEFAULT.*) # '"${2}"'$/ {
33 s/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT *"\([^"]*\)").*$/\1/
34 s/${CMake_VERSION_MAJOR}/'"${cmake_version_major}"'/
35 s/${CMake_VERSION_MINOR}/'"${cmake_version_minor}"'/
36 s/${CMake_VERSION_PATCH}/'"${cmake_version_patch}"'/
45 echo "$1" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
48 # Detect system and directory information.
50 cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
51 cmake_binary_dir=`pwd`
53 # Load version information.
54 cmake_version_major="`cmake_version_component MAJOR`"
55 cmake_version_minor="`cmake_version_component MINOR`"
56 cmake_version_patch="`cmake_version_component PATCH`"
57 cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
58 cmake_version_rc="`cmake_version_component RC`"
59 if [ "$cmake_version_rc" != "" ]; then
60 cmake_version="${cmake_version}-rc${cmake_version_rc}"
63 cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.txt"`"
65 cmake_bin_dir_keyword="OTHER"
66 cmake_data_dir_keyword="OTHER"
67 cmake_doc_dir_keyword="OTHER"
68 cmake_man_dir_keyword="OTHER"
69 cmake_xdgdata_dir_keyword="OTHER"
76 cmake_bootstrap_system_libs=""
77 cmake_bootstrap_qt_gui=""
78 cmake_bootstrap_qt_qmake=""
79 cmake_bootstrap_server=""
82 cmake_sphinx_qthelp=""
86 # Determine whether this is a Cygwin environment.
87 if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
88 cmake_system_cygwin=true
89 cmake_doc_dir_keyword="CYGWIN"
90 cmake_man_dir_keyword="CYGWIN"
92 cmake_system_cygwin=false
95 # Determine whether this is a MinGW environment.
96 if echo "${cmake_system}" | grep 'MINGW\|MSYS' >/dev/null 2>&1; then
97 cmake_system_mingw=true
99 cmake_system_mingw=false
102 # Determine whether this is OS X
103 if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
104 cmake_system_darwin=true
106 cmake_system_darwin=false
109 # Determine whether this is BeOS
110 if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
111 cmake_system_beos=true
112 cmake_doc_dir_keyword="HAIKU"
113 cmake_man_dir_keyword="HAIKU"
115 cmake_system_beos=false
118 # Determine whether this is Haiku
119 if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
120 cmake_system_haiku=true
121 cmake_doc_dir_keyword="HAIKU"
122 cmake_man_dir_keyword="HAIKU"
124 cmake_system_haiku=false
127 # Determine whether this is OpenVMS
128 if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
129 cmake_system_openvms=true
131 cmake_system_openvms=false
134 # Determine whether this is HP-UX
135 if echo "${cmake_system}" | grep HP-UX >/dev/null 2>&1; then
136 cmake_system_hpux=true
138 cmake_system_hpux=false
141 # Determine whether this is Linux
142 if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
143 cmake_system_linux=true
145 cmake_system_linux=false
148 # Determine whether this is a PA-RISC machine
149 # This only works for Linux or HP-UX, not other PA-RISC OSs (BSD maybe?). Also
150 # may falsely detect parisc on HP-UX m68k
151 cmake_machine_parisc=false
152 if ${cmake_system_linux}; then
153 if uname -m | grep parisc >/dev/null 2>&1; then
154 cmake_machine_parisc=true
156 elif ${cmake_system_hpux}; then
157 if uname -m | grep ia64 >/dev/null 2>&1; then : ; else
158 cmake_machine_parisc=true
162 # Choose the generator to use for bootstrapping.
163 if ${cmake_system_mingw}; then
164 # Bootstrapping from an MSYS prompt.
165 cmake_bootstrap_generator="MSYS Makefiles"
167 # Bootstrapping from a standard UNIX prompt.
168 cmake_bootstrap_generator="Unix Makefiles"
171 # Choose tools and extensions for this platform.
172 if ${cmake_system_openvms}; then
182 # Construct bootstrap directory name.
183 cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
185 # Helper function to fix windows paths.
186 case "${cmake_system}" in
190 cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
196 echo "$1" | sed 's/\\/\//g'
201 # Choose the default install prefix.
202 if ${cmake_system_mingw}; then
203 if [ "x${PROGRAMFILES}" != "x" ]; then
204 cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
205 elif [ "x${ProgramFiles}" != "x" ]; then
206 cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
207 elif [ "x${SYSTEMDRIVE}" != "x" ]; then
208 cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
209 elif [ "x${SystemDrive}" != "x" ]; then
210 cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
212 cmake_default_prefix="c:/Program Files/CMake"
214 elif ${cmake_system_haiku}; then
215 cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
217 cmake_default_prefix="/usr/local"
220 # Lookup default install destinations.
221 cmake_bin_dir_default="`cmake_install_dest_default BIN ${cmake_bin_dir_keyword}`"
222 cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`"
223 cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`"
224 cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`"
225 cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`"
227 CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
228 CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
229 CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
231 CMAKE_PROBLEMATIC_FILES="\
234 CMakeCCompiler.cmake \
235 CMakeCXXCompiler.cmake \
236 */CMakeSystem.cmake \
237 */CMakeCCompiler.cmake \
238 */CMakeCXXCompiler.cmake \
239 Source/cmConfigure.h \
240 Source/CTest/Curl/config.h \
241 Utilities/cmexpat/expatConfig.h \
242 Utilities/cmexpat/expatDllConfig.h \
245 CMAKE_UNUSED_SOURCES="\
246 cmGlobalXCodeGenerator \
247 cmLocalXCodeGenerator \
254 cmAddCustomCommandCommand \
255 cmAddCustomTargetCommand \
256 cmAddDefinitionsCommand \
257 cmAddDependenciesCommand \
258 cmAddExecutableCommand \
259 cmAddLibraryCommand \
260 cmAddSubDirectoryCommand \
264 cmCMakeMinimumRequired \
265 cmCMakePolicyCommand \
266 cmCPackPropertiesGenerator \
269 cmCommandArgumentParserHelper \
270 cmCommandArgumentsHelper \
272 cmCommonTargetGenerator \
273 cmComputeComponentGraph \
274 cmComputeLinkDepends \
275 cmComputeLinkInformation \
276 cmComputeTargetDepends \
277 cmConditionEvaluator \
278 cmConfigureFileCommand \
281 cmCreateTestSourceList \
283 cmCustomCommandGenerator \
284 cmDefinePropertyCommand \
288 cmDisallowedCommand \
289 cmDocumentationFormatter \
290 cmEnableLanguageCommand \
291 cmEnableTestingCommand \
292 cmExecProgramCommand \
293 cmExecuteProcessCommand \
294 cmExpandedCommandArgument \
295 cmExportBuildFileGenerator \
296 cmExportFileGenerator \
297 cmExportInstallFileGenerator \
300 cmExportTryCompileFileGenerator \
302 cmExternalMakefileProjectGenerator \
304 cmFileTimeComparison \
308 cmFindLibraryCommand \
309 cmFindPackageCommand \
311 cmFindProgramCommand \
314 cmGeneratedFileStream \
315 cmGeneratorExpression \
316 cmGeneratorExpressionContext \
317 cmGeneratorExpressionDAGChecker \
318 cmGeneratorExpressionEvaluationFile \
319 cmGeneratorExpressionEvaluator \
320 cmGeneratorExpressionLexer \
321 cmGeneratorExpressionNode \
322 cmGeneratorExpressionParser \
324 cmGetCMakePropertyCommand \
325 cmGetDirectoryPropertyCommand \
326 cmGetFilenameComponentCommand \
327 cmGetPropertyCommand \
328 cmGetSourceFilePropertyCommand \
329 cmGetTargetPropertyCommand \
330 cmGetTestPropertyCommand \
331 cmGlobalCommonGenerator \
333 cmGlobalUnixMakefileGenerator3 \
337 cmIncludeDirectoryCommand \
338 cmIncludeRegularExpressionCommand \
340 cmInstallCommandArguments \
341 cmInstallDirectoryGenerator \
342 cmInstallExportGenerator \
343 cmInstallFilesCommand \
344 cmInstallFilesGenerator \
346 cmInstallScriptGenerator \
347 cmInstallTargetGenerator \
348 cmInstallTargetsCommand \
350 cmLinkDirectoriesCommand \
354 cmLocalCommonGenerator \
356 cmLocalUnixMakefileGenerator3 \
357 cmMSVC60LinkLineComputer \
359 cmMakeDirectoryCommand \
361 cmMakefileExecutableTargetGenerator \
362 cmMakefileLibraryTargetGenerator \
363 cmMakefileTargetGenerator \
364 cmMakefileUtilityTargetGenerator \
365 cmMarkAsAdvancedCommand \
370 cmOSXBundleGenerator \
374 cmParseArgumentsCommand \
380 cmPropertyDefinition \
381 cmPropertyDefinitionMap \
384 cmRulePlaceholderExpander \
387 cmSeparateArgumentsCommand \
389 cmSetDirectoryPropertiesCommand \
390 cmSetPropertyCommand \
391 cmSetSourceFilesPropertiesCommand \
392 cmSetTargetPropertiesCommand \
393 cmSetTestsPropertiesCommand \
396 cmSourceFileLocation \
404 cmTargetLinkLibrariesCommand \
405 cmTargetPropertyComputer \
409 cmTryCompileCommand \
411 cmUnexpectedCommand \
421 if ${cmake_system_mingw}; then
422 CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
423 cmGlobalMSYSMakefileGenerator \
424 cmGlobalMinGWMakefileGenerator"
427 LexerParser_CXX_SOURCES="\
428 cmCommandArgumentLexer \
429 cmCommandArgumentParser \
434 LexerParser_C_SOURCES="\
438 if ${cmake_system_mingw}; then
469 RegularExpression.hxx \
476 # Display CMake bootstrap usage
480 Usage: '"$0"' [<options>...] [-- <cmake-options>...]
481 Options: [defaults in brackets after descriptions]
483 --help print this message
484 --version only print version information
485 --verbose display more information
486 --parallel=n bootstrap cmake in parallel, where n is
488 --enable-ccache Enable ccache when building cmake
489 --init=FILE load FILE as script to populate cache
490 --system-libs use all system-installed third-party libraries
491 (for use only by package maintainers)
492 --no-system-libs use all cmake-provided third-party libraries
494 --system-curl use system-installed curl library
495 --no-system-curl use cmake-provided curl library (default)
496 --system-expat use system-installed expat library
497 --no-system-expat use cmake-provided expat library (default)
498 --system-jsoncpp use system-installed jsoncpp library
499 --no-system-jsoncpp use cmake-provided jsoncpp library (default)
500 --system-zlib use system-installed zlib library
501 --no-system-zlib use cmake-provided zlib library (default)
502 --system-bzip2 use system-installed bzip2 library
503 --no-system-bzip2 use cmake-provided bzip2 library (default)
504 --system-liblzma use system-installed liblzma library
505 --no-system-liblzma use cmake-provided liblzma library (default)
506 --system-libarchive use system-installed libarchive library
507 --no-system-libarchive use cmake-provided libarchive library (default)
508 --system-librhash use system-installed librhash library
509 --no-system-librhash use cmake-provided librhash library (default)
511 --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
512 --no-qt-gui do not build the Qt-based GUI (default)
513 --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
515 --server enable the server mode (default if supported)
516 --no-server disable the server mode
518 --sphinx-man build man pages with Sphinx
519 --sphinx-html build html help with Sphinx
520 --sphinx-qthelp build qch help with Sphinx
521 --sphinx-build=<sb> use <sb> as the sphinx-build executable
522 --sphinx-flags=<flags> pass <flags> to sphinx-build executable
524 Directory and file names:
525 --prefix=PREFIX install files in tree rooted at PREFIX
526 ['"${cmake_default_prefix}"']
527 --bindir=DIR install binaries in PREFIX/DIR
528 ['"${cmake_bin_dir_default}"']
529 --datadir=DIR install data files in PREFIX/DIR
530 ['"${cmake_data_dir_default}"']
531 --docdir=DIR install documentation files in PREFIX/DIR
532 ['"${cmake_doc_dir_default}"']
533 --mandir=DIR install man pages files in PREFIX/DIR/manN
534 ['"${cmake_man_dir_default}"']
535 --xdgdatadir=DIR install XDG specific files in PREFIX/DIR
536 ['"${cmake_xdgdata_dir_default}"']
541 # Display CMake bootstrap usage
542 cmake_version_display()
544 echo "CMake ${cmake_version}, ${cmake_copyright}"
547 # Display CMake bootstrap error, display the log file and exit
552 echo "---------------------------------------------"
553 echo "Error when bootstrapping CMake:"
555 echo "---------------------------------------------"
556 if [ -f cmake_bootstrap.log ]; then
557 echo "Log of errors: `pwd`/cmake_bootstrap.log"
558 #cat cmake_bootstrap.log
559 echo "---------------------------------------------"
564 cmake_generate_file ()
568 echo "$CONTENT" > "$OUTFILE.tmp"
569 if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then
572 mv -f "$OUTFILE.tmp" "$OUTFILE"
576 # Replace KWSYS_NAMESPACE with cmsys
577 cmake_replace_string ()
583 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
585 sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" > "${OUTFILE}${_tmp}"
586 if [ -f "${OUTFILE}${_tmp}" ]; then
587 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
588 #echo "Files are the same"
589 rm -f "${OUTFILE}${_tmp}"
591 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
595 cmake_error 1 "Cannot find file ${INFILE}"
599 cmake_kwsys_config_replace_string ()
605 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
606 echo "${APPEND}" > "${OUTFILE}${_tmp}"
608 sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
609 s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
610 s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
611 s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
612 s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
613 s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g;
614 s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g;
615 }" >> "${OUTFILE}${_tmp}"
616 if [ -f "${OUTFILE}${_tmp}" ]; then
617 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
618 #echo "Files are the same"
619 rm -f "${OUTFILE}${_tmp}"
621 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
625 cmake_error 2 "Cannot find file ${INFILE}"
628 # Write string into a file
636 # Escape spaces in strings
639 echo $1 | sed "s/ /\\\\ /g"
642 # Strip prefix from argument
645 echo "$1" | sed "s/^${2-[^=]*=}//"
648 # Write message to the log
651 echo "$*" >> cmake_bootstrap.log
657 echo "cmake_bootstrap_$$_test"
660 # Run a compiler test. First argument is compiler, second one are compiler
661 # flags, third one is test source file to be compiled
667 if [ ! -f "${TESTFILE}" ]; then
668 echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
671 TMPFILE=`cmake_tmp_file`
672 echo "Try: ${COMPILER}"
673 echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
674 echo "---------- file -----------------------"
676 echo "------------------------------------------"
677 "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
679 if [ "${RES}" -ne "0" ]; then
680 echo "Test failed to compile"
683 if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
684 echo "Test failed to produce executable"
690 if [ "${RES}" -ne "0" ]; then
691 echo "Test produced non-zero return code"
694 echo "Test succeeded"
698 # Run a make test. First argument is the make interpreter.
703 echo "Try: ${MAKE_PROC}"
704 "${MAKE_PROC}" ${MAKE_FLAGS}
706 if [ "${RES}" -ne "0" ]; then
707 echo "${MAKE_PROC} does not work"
710 if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
711 echo "${COMPILER} does not produce output"
717 if [ "${RES}" -ne "0" ]; then
718 echo "${MAKE_PROC} produces strange executable"
721 echo "${MAKE_PROC} works"
728 cmake_ccache_enabled=
729 cmake_prefix_dir="${cmake_default_prefix}"
730 while test $# != 0; do
732 --prefix=*) dir=`cmake_arg "$1"`
733 cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
734 --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
735 --bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;;
736 --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
737 --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
738 --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
739 --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;;
740 --init=*) cmake_init_file=`cmake_arg "$1"` ;;
741 --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
742 --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
743 --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma)
744 lib=`cmake_arg "$1" "--system-"`
745 cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
746 --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-librhash|--no-system-zlib|--no-system-liblzma)
747 lib=`cmake_arg "$1" "--no-system-"`
748 cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
749 --qt-gui) cmake_bootstrap_qt_gui="1" ;;
750 --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
751 --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
752 --server) cmake_bootstrap_server="1" ;;
753 --no-server) cmake_bootstrap_server="0" ;;
754 --sphinx-man) cmake_sphinx_man="1" ;;
755 --sphinx-html) cmake_sphinx_html="1" ;;
756 --sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
757 --sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
758 --sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
759 --help) cmake_usage ;;
760 --version) cmake_version_display ; exit 2 ;;
761 --verbose) cmake_verbose=TRUE ;;
762 --enable-ccache) cmake_ccache_enabled=TRUE ;;
764 *) die "Unknown option: $1" ;;
769 # If verbose, display some information about bootstrap
770 if [ -n "${cmake_verbose}" ]; then
771 echo "---------------------------------------------"
772 echo "Source directory: ${cmake_source_dir}"
773 echo "Binary directory: ${cmake_binary_dir}"
774 echo "Prefix directory: ${cmake_prefix_dir}"
775 echo "System: ${cmake_system}"
776 if [ "x${cmake_parallel_make}" != "x" ]; then
777 echo "Doing parallel make: ${cmake_parallel_make}"
782 echo "---------------------------------------------"
784 echo "`cmake_version_display`"
786 # Check for in-source build
787 cmake_in_source_build=
788 if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
789 -f "${cmake_binary_dir}/Source/cmake.h" ]; then
790 if [ -n "${cmake_verbose}" ]; then
791 echo "Warning: This is an in-source build"
793 cmake_in_source_build=TRUE
796 # If this is not an in-source build, then Bootstrap stuff should not exist.
797 if [ -z "${cmake_in_source_build}" ]; then
798 # Did somebody bootstrap in the source tree?
799 if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
800 cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
801 Looks like somebody did bootstrap CMake in the source tree, but now you are
802 trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
803 directory from the source tree."
805 # Is there a cache in the source tree?
806 for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
807 if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
808 cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
809 Looks like somebody tried to build CMake in the source tree, but now you are
810 trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
811 from the source tree."
816 # Make bootstrap directory
817 [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
818 if [ ! -d "${cmake_bootstrap_dir}" ]; then
819 cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
821 cd "${cmake_bootstrap_dir}"
823 [ -d "cmsys" ] || mkdir "cmsys"
824 if [ ! -d "cmsys" ]; then
825 cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
828 # Delete all the bootstrap files
829 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
830 rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
831 rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
833 # If building in-source, remove any cmConfigure.h that may
834 # have been created by a previous run of the bootstrap cmake.
835 if [ -n "${cmake_in_source_build}" ]; then
836 rm -f "${cmake_source_dir}/Source/cmConfigure.h"
839 # If exist compiler flags, set them
840 cmake_c_flags=${CFLAGS}
841 cmake_cxx_flags=${CXXFLAGS}
842 cmake_ld_flags=${LDFLAGS}
844 # Add Cygwin-specific flags
845 if ${cmake_system_cygwin}; then
846 cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
849 # Add CoreFoundation framework on Darwin
850 if ${cmake_system_darwin}; then
851 cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
854 # Add BeOS toolkits...
855 if ${cmake_system_beos}; then
856 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
859 # Add Haiku toolkits...
860 if ${cmake_system_haiku}; then
861 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
864 # Workaround for short jump tables on PA-RISC
865 if ${cmake_machine_parisc}; then
866 if ${cmake_c_compiler_is_gnu}; then
867 cmake_c_flags="${CFLAGS} -mlong-calls"
869 if ${cmake_cxx_compiler_is_gnu}; then
870 cmake_cxx_flags="${CXXFLAGS} -mlong-calls"
874 #-----------------------------------------------------------------------------
875 # Detect known toolchains on some platforms.
877 case "${cmake_system}" in
878 *AIX*) cmake_toolchains='XL GNU' ;;
879 *CYGWIN*) cmake_toolchains='GNU' ;;
880 *Darwin*) cmake_toolchains='Clang GNU' ;;
881 *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
882 *MINGW*) cmake_toolchains='GNU' ;;
885 # Toolchain compiler name table.
886 cmake_toolchain_Clang_CC='clang'
887 cmake_toolchain_Clang_CXX='clang++'
888 cmake_toolchain_GNU_CC='gcc'
889 cmake_toolchain_GNU_CXX='g++'
890 cmake_toolchain_PGI_CC='pgcc'
891 cmake_toolchain_PGI_CXX='pgCC'
892 cmake_toolchain_PathScale_CC='pathcc'
893 cmake_toolchain_PathScale_CXX='pathCC'
894 cmake_toolchain_XL_CC='xlc'
895 cmake_toolchain_XL_CXX='xlC'
897 cmake_toolchain_try()
900 TMPFILE=`cmake_tmp_file`
902 eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
903 echo 'int main() { return 0; }' > "${TMPFILE}.c"
904 cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
907 test "${tc_result_CC}" = "0" || return 1
909 eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
910 echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
911 cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
913 rm -f "${TMPFILE}.cpp"
914 test "${tc_result_CXX}" = "0" || return 1
916 cmake_toolchain="$tc"
919 cmake_toolchain_detect()
922 for tc in ${cmake_toolchains}; do
923 echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
924 cmake_toolchain_try "$tc" &&
925 echo "Found $tc toolchain" &&
930 if [ -z "${CC}" -a -z "${CXX}" ]; then
931 cmake_toolchain_detect
934 #-----------------------------------------------------------------------------
938 # If CC is set, use that for compiler, otherwise use list of known compilers
939 if [ -n "${cmake_toolchain}" ]; then
940 eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
941 elif [ -n "${CC}" ]; then
942 cmake_c_compilers="${CC}"
944 cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
947 # Check if C compiler works
948 TMPFILE=`cmake_tmp_file`
951 # error "The CMAKE_C_COMPILER is set to a C++ compiler"
956 #if defined(__CLASSIC_C__)
961 int main(int argc, char* argv[])
964 printf("%d%c", (argv != 0), (char)0x0a);
968 for a in ${cmake_c_compilers}; do
969 if [ -z "${cmake_c_compiler}" ] && \
970 cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
971 cmake_c_compiler="${a}"
974 for std in 11 99 90; do
975 try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
976 for flag in $try_flags; do
977 echo "Checking whether ${cmake_c_compiler} supports ${flag}" >> cmake_bootstrap.log 2>&1
978 if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags} ${flag}" \
979 "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
980 cmake_c_flags="${cmake_c_flags} ${flag}"
987 if [ -z "${cmake_c_compiler}" ]; then
988 cmake_error 6 "Cannot find appropriate C compiler on this system.
989 Please specify one using environment variable CC.
990 See cmake_bootstrap.log for compilers attempted.
993 echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
995 #-----------------------------------------------------------------------------
999 # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
1001 # If CC is set, use that for compiler, otherwise use list of known compilers
1002 if [ -n "${cmake_toolchain}" ]; then
1003 eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
1004 elif [ -n "${CXX}" ]; then
1005 cmake_cxx_compilers="${CXX}"
1007 cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
1010 # Check if C++ compiler works
1011 TMPFILE=`cmake_tmp_file`
1014 # include <iostream>
1016 # include <iostream.h>
1019 #if __cplusplus >= 201103L && defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
1020 #error "SunPro <= 5.13 C++ 11 mode not supported due to bug in move semantics."
1026 NeedCXX() { this->Foo = 1; }
1027 int GetFoo() { return this->Foo; }
1035 cout << c.GetFoo() << endl;
1037 std::cout << c.GetFoo() << std::endl;
1041 ' > "${TMPFILE}.cxx"
1042 for a in ${cmake_cxx_compilers}; do
1044 if [ -z "${cmake_cxx_compiler}" ] && \
1045 cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1046 cmake_cxx_compiler="${a}"
1050 for std in 14 11 98; do
1051 try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
1052 for flag in $try_flags; do
1053 echo "Checking for wheter ${cmake_cxx_flags} supports ${flag}" >> cmake_bootstrap.log 2>&1
1054 if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags} ${flag} -DTEST1" \
1055 "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1056 cmake_cxx_flags="${cmake_cxx_flags} ${flag} "
1061 rm -f "${TMPFILE}.cxx"
1063 if [ -z "${cmake_cxx_compiler}" ]; then
1064 cmake_error 7 "Cannot find appropriate C++ compiler on this system.
1065 Please specify one using environment variable CXX.
1066 See cmake_bootstrap.log for compilers attempted."
1068 echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
1070 #-----------------------------------------------------------------------------
1073 cmake_make_processor=
1076 # If MAKE is set, use that for make processor, otherwise use list of known make
1077 if [ -n "${MAKE}" ]; then
1078 cmake_make_processors="${MAKE}"
1080 cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
1083 TMPFILE="`cmake_tmp_file`_dir"
1084 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
1085 mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
1086 cd "${cmake_bootstrap_dir}/${TMPFILE}"
1089 "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
1093 int main(){ printf("1%c", (char)0x0a); return 0; }
1095 cmake_original_make_flags="${cmake_make_flags}"
1096 if [ "x${cmake_parallel_make}" != "x" ]; then
1097 cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
1099 for a in ${cmake_make_processors}; do
1100 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
1101 cmake_make_processor="${a}"
1104 cmake_full_make_flags="${cmake_make_flags}"
1105 if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
1106 if [ -z "${cmake_make_processor}" ]; then
1107 cmake_make_flags="${cmake_original_make_flags}"
1108 for a in ${cmake_make_processors}; do
1109 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
1110 cmake_make_processor="${a}"
1115 cd "${cmake_bootstrap_dir}"
1117 if [ -z "${cmake_make_processor}" ]; then
1118 cmake_error 8 "Cannot find appropriate Makefile processor on this system.
1119 Please specify one using environment variable MAKE."
1121 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
1122 echo "Makefile processor on this system is: ${cmake_make_processor}"
1123 if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
1124 echo "---------------------------------------------"
1125 echo "Makefile processor ${cmake_make_processor} does not support parallel build"
1126 echo "---------------------------------------------"
1129 # Ok, we have CC, CXX, and MAKE.
1131 # Test C++ compiler features
1135 TMPFILE=`cmake_tmp_file`
1137 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
1139 int main() { std::cout << "This is GNU" << std::endl; return 0;}
1142 cmake_cxx_compiler_is_gnu=0
1143 if cmake_try_run "${cmake_cxx_compiler}" \
1144 "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1145 cmake_cxx_compiler_is_gnu=1
1147 if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then
1148 echo "${cmake_cxx_compiler} is GNU compiler"
1150 echo "${cmake_cxx_compiler} is not GNU compiler"
1152 rm -f "${TMPFILE}.cxx"
1154 if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
1155 # Check for non-GNU compiler flags
1157 # If we are on HP-UX, check for -Ae for the C compiler.
1158 if [ "x${cmake_system}" = "xHP-UX" ]; then
1159 cmake_test_flags="-Ae"
1160 TMPFILE=`cmake_tmp_file`
1162 int main(int argc, char** argv) { (void)argc; (void)argv; return 0; }
1165 if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1168 if cmake_try_run "${cmake_c_compiler}" \
1169 "${cmake_c_flags} ${cmake_test_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1173 if [ "x${cmake_need_Ae}" = "x1" ]; then
1174 cmake_c_flags="${cmake_c_flags} ${cmake_test_flags}"
1175 echo "${cmake_c_compiler} needs ${cmake_test_flags}"
1177 echo "${cmake_c_compiler} does not need ${cmake_test_flags}"
1179 rm -f "${TMPFILE}.c"
1182 int main(int argc, char** argv) {
1183 for(int i=0; i < 1; ++i);
1184 for(int i=0; i < 1; ++i);
1185 (void)argc; (void)argv; return 0; }
1187 cmake_need_AAstd98=0
1188 cmake_test_flags="-AA +hpxstd98"
1189 if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1192 if cmake_try_run "${cmake_cxx_compiler}" \
1193 "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1194 cmake_need_AAstd98=1
1197 if [ "x${cmake_need_AAstd98}" = "x1" ]; then
1198 cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}"
1199 echo "${cmake_cxx_compiler} needs ${cmake_test_flags}"
1201 echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}"
1208 # Test for kwsys features
1209 KWSYS_NAME_IS_KWSYS=0
1210 KWSYS_BUILD_SHARED=0
1211 KWSYS_LFS_AVAILABLE=0
1212 KWSYS_LFS_REQUESTED=0
1213 KWSYS_STL_HAS_WSTRING=0
1214 KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=0
1215 KWSYS_CXX_HAS_SETENV=0
1216 KWSYS_CXX_HAS_UNSETENV=0
1217 KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
1218 KWSYS_CXX_HAS_UTIMENSAT=0
1219 KWSYS_CXX_HAS_UTIMES=0
1221 if cmake_try_run "${cmake_cxx_compiler}" \
1222 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
1223 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1224 KWSYS_CXX_HAS_SETENV=1
1225 echo "${cmake_cxx_compiler} has setenv"
1227 echo "${cmake_cxx_compiler} does not have setenv"
1230 if cmake_try_run "${cmake_cxx_compiler}" \
1231 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
1232 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1233 KWSYS_CXX_HAS_UNSETENV=1
1234 echo "${cmake_cxx_compiler} has unsetenv"
1236 echo "${cmake_cxx_compiler} does not have unsetenv"
1239 if cmake_try_run "${cmake_cxx_compiler}" \
1240 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
1241 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1242 KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
1243 echo "${cmake_cxx_compiler} has environ in stdlib.h"
1245 echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
1248 if cmake_try_run "${cmake_cxx_compiler}" \
1249 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_WSTRING" \
1250 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1251 KWSYS_STL_HAS_WSTRING=1
1252 echo "${cmake_cxx_compiler} has stl wstring"
1254 echo "${cmake_cxx_compiler} does not have stl wstring"
1257 if cmake_try_run "${cmake_cxx_compiler}" \
1258 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H" \
1259 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1260 KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=1
1261 echo "${cmake_cxx_compiler} has <ext/stdio_filebuf.h>"
1263 echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>"
1266 # Just to be safe, let us store compiler and flags to the header file
1268 cmake_bootstrap_version='$Revision$'
1269 cmake_compiler_settings_comment="/*
1270 * Generated by ${cmake_source_dir}/bootstrap
1271 * Version: ${cmake_bootstrap_version}
1273 * Source directory: ${cmake_source_dir}
1274 * Binary directory: ${cmake_bootstrap_dir}
1276 * C compiler: ${cmake_c_compiler}
1277 * C flags: ${cmake_c_flags}
1279 * C++ compiler: ${cmake_cxx_compiler}
1280 * C++ flags: ${cmake_cxx_flags}
1282 * Make: ${cmake_make_processor}
1285 * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
1286 * LexerParser Sources:
1287 * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES}
1289 * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
1293 cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
1295 # When bootstrapping on MinGW with MSYS we must convert the source
1296 # directory to a windows path.
1297 if ${cmake_system_mingw}; then
1298 CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W`
1299 CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W`
1301 CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}"
1302 CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}"
1305 # Write CMake version
1306 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
1307 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
1308 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
1309 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
1310 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\""
1311 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\""
1312 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
1313 cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
1314 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
1315 cmake_report cmConfigure.h${_tmp} "#define CM_EQ_DELETE"
1316 cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
1317 cmake_report cmConfigure.h${_tmp} "#define CM_NULLPTR 0"
1318 cmake_report cmConfigure.h${_tmp} "#define CM_OVERRIDE"
1319 cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)"
1321 # Regenerate configured headers
1322 for h in Configure VersionConfig; do
1323 if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
1324 rm -f cm${h}.h${_tmp}
1326 mv -f cm${h}.h${_tmp} cm${h}.h
1331 cmake_kwsys_config_replace_string \
1332 "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
1333 "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
1334 "${cmake_compiler_settings_comment}"
1335 cmake_kwsys_config_replace_string \
1336 "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
1337 "${cmake_bootstrap_dir}/cmsys/Configure.h" \
1338 "${cmake_compiler_settings_comment}"
1340 for a in ${KWSYS_FILES}; do
1341 cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
1342 "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
1345 cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" ""
1348 dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
1350 for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
1351 objs="${objs} ${a}.o"
1354 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
1355 cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
1358 if [ "x${cmake_c_flags}" != "x" ]; then
1359 cmake_c_flags="${cmake_c_flags} "
1362 if [ "x${cmake_cxx_flags}" != "x" ]; then
1363 cmake_cxx_flags="${cmake_cxx_flags} "
1366 cmake_c_flags_String="-DKWSYS_STRING_C"
1367 if ${cmake_system_mingw}; then
1368 cmake_c_flags_EncodingC="-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_ACP"
1369 cmake_cxx_flags_EncodingCXX="${cmake_c_flags_EncodingC}"
1370 cmake_cxx_flags_cmProcessOutput="${cmake_c_flags_EncodingC}"
1372 cmake_cxx_flags_SystemTools="
1373 -DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
1374 -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
1375 -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
1376 -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
1377 -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
1379 cmake_c_flags="${cmake_c_flags} \
1380 -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
1381 -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1382 -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
1383 -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
1384 cmake_cxx_flags="${cmake_cxx_flags} \
1385 -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
1386 -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1387 -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
1388 -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
1389 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
1390 echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
1391 for a in ${CMAKE_CXX_SOURCES}; do
1392 src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
1393 src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1394 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1395 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1397 for a in ${CMAKE_C_SOURCES}; do
1398 src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
1399 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1400 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1402 for a in ${LexerParser_CXX_SOURCES}; do
1403 src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.cxx"`
1404 src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1405 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1406 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1408 for a in ${LexerParser_C_SOURCES}; do
1409 src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.c"`
1410 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1411 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1413 for a in ${KWSYS_C_SOURCES}; do
1414 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
1415 src_flags=`eval echo \\${cmake_c_flags_\${a}}`
1416 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1417 echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1419 for a in ${KWSYS_CXX_SOURCES}; do
1420 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
1421 src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1422 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1423 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1427 cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
1428 ' >> "${cmake_bootstrap_dir}/Makefile"
1430 # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
1432 # Generated by '"${cmake_source_dir}"'/bootstrap
1433 # Default cmake settings. These may be overridden any settings below.
1434 set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
1435 set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
1436 set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
1437 set (CMAKE_BIN_DIR "'"${cmake_bin_dir}"'" CACHE PATH "Install location for binaries (relative to prefix)." FORCE)
1438 set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
1439 set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE)
1440 ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1442 # Add configuration settings given as command-line options.
1443 if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
1445 set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
1446 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1448 if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
1450 set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
1451 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1453 if [ "x${cmake_bootstrap_server}" != "x" ]; then
1455 set (CMake_ENABLE_SERVER_MODE '"${cmake_bootstrap_server}"' CACHE BOOL "Enable server mode" FORCE)
1456 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1458 if [ "x${cmake_sphinx_man}" != "x" ]; then
1460 set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE)
1461 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1463 if [ "x${cmake_sphinx_html}" != "x" ]; then
1465 set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE)
1466 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1468 if [ "x${cmake_sphinx_qthelp}" != "x" ]; then
1470 set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
1471 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1473 if [ "x${cmake_sphinx_build}" != "x" ]; then
1475 set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
1476 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1478 if [ "x${cmake_sphinx_flags}" != "x" ]; then
1480 set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
1481 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1484 # Add user-specified settings. Handle relative-path case for
1485 # specification of cmake_init_file.
1487 cd "${cmake_binary_dir}"
1488 if [ -f "${cmake_init_file}" ]; then
1489 cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1493 echo "---------------------------------------------"
1495 # Run make to build bootstrap cmake
1496 if [ "x${cmake_parallel_make}" != "x" ]; then
1497 ${cmake_make_processor} ${cmake_make_flags}
1499 ${cmake_make_processor}
1502 if [ "${RES}" -ne "0" ]; then
1503 cmake_error 9 "Problem while running ${cmake_make_processor}"
1505 cd "${cmake_binary_dir}"
1507 # Set C, CXX, and MAKE environment variables, so that real real cmake will be
1508 # build with same compiler and make
1509 CC="${cmake_c_compiler}"
1510 CXX="${cmake_cxx_compiler}"
1511 if [ -n "${cmake_ccache_enabled}" ]; then
1515 MAKE="${cmake_make_processor}"
1520 # Run bootstrap CMake to configure real CMake
1521 cmake_options="-DCMAKE_BOOTSTRAP=1"
1522 if [ -n "${cmake_verbose}" ]; then
1523 cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
1525 "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
1527 if [ "${RES}" -ne "0" ]; then
1528 cmake_error 11 "Problem while running initial CMake"
1531 echo "---------------------------------------------"
1533 # And we are done. Now just run make
1534 echo "CMake has bootstrapped. Now run ${cmake_make_processor}."