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 sed -n "s/ *set *( *CMAKE_${2}${3}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
13 "${cmake_source_dir}/Modules/Compiler/"${1:-*}-${2}.cmake 2>/dev/null | tr ';' ' '
16 # Version number extraction function.
17 cmake_version_component()
20 /^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
21 " "${cmake_source_dir}/Source/CMakeVersion.cmake"
24 # Install destination extraction function.
25 cmake_install_dest_default()
28 /^ *set(CMAKE_'"${1}"'_DIR_DEFAULT.*) # '"${2}"'$/ {
29 s/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT *"\([^"]*\)").*$/\1/
30 s/${CMake_VERSION_MAJOR}/'"${cmake_version_major}"'/
31 s/${CMake_VERSION_MINOR}/'"${cmake_version_minor}"'/
32 s/${CMake_VERSION_PATCH}/'"${cmake_version_patch}"'/
36 ' "${cmake_source_dir}/Source/CMakeInstallDestinations.cmake"
41 echo "$1" | tr '[:lower:]' '[:upper:]'
44 # Detect system and directory information.
46 cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
47 cmake_binary_dir=`pwd`
49 # Load version information.
50 cmake_version_major="`cmake_version_component MAJOR`"
51 cmake_version_minor="`cmake_version_component MINOR`"
52 cmake_version_patch="`cmake_version_component PATCH`"
53 cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
54 cmake_version_rc="`cmake_version_component RC`"
55 if [ "$cmake_version_rc" != "" ]; then
56 cmake_version="${cmake_version}-rc${cmake_version_rc}"
59 cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.txt"`"
61 cmake_bin_dir_keyword="OTHER"
62 cmake_data_dir_keyword="OTHER"
63 cmake_doc_dir_keyword="OTHER"
64 cmake_man_dir_keyword="OTHER"
65 cmake_xdgdata_dir_keyword="OTHER"
72 cmake_bootstrap_system_libs=""
73 cmake_bootstrap_qt_gui=""
74 cmake_bootstrap_qt_qmake=""
78 cmake_sphinx_qthelp=""
82 # Determine whether this is a Cygwin environment.
83 if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
84 cmake_system_cygwin=true
85 cmake_doc_dir_keyword="CYGWIN"
86 cmake_man_dir_keyword="CYGWIN"
88 cmake_system_cygwin=false
91 # Determine whether this is a MinGW environment.
92 if echo "${cmake_system}" | grep 'MINGW\|MSYS' >/dev/null 2>&1; then
93 cmake_system_mingw=true
95 cmake_system_mingw=false
98 # Determine whether this is OS X
99 if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
100 cmake_system_darwin=true
102 cmake_system_darwin=false
105 # Determine whether this is BeOS
106 if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
107 cmake_system_beos=true
108 cmake_doc_dir_keyword="HAIKU"
109 cmake_man_dir_keyword="HAIKU"
111 cmake_system_beos=false
114 # Determine whether this is Haiku
115 if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
116 cmake_system_haiku=true
117 cmake_doc_dir_keyword="HAIKU"
118 cmake_man_dir_keyword="HAIKU"
120 cmake_system_haiku=false
123 # Determine whether this is OpenVMS
124 if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
125 cmake_system_openvms=true
127 cmake_system_openvms=false
130 # Determine whether this is HP-UX
131 if echo "${cmake_system}" | grep HP-UX >/dev/null 2>&1; then
132 die 'CMake no longer compiles on HP-UX. See
134 https://gitlab.kitware.com/cmake/cmake/issues/17137
136 Use CMake 3.9 or lower instead.'
137 cmake_system_hpux=true
139 cmake_system_hpux=false
142 # Determine whether this is Linux
143 if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
144 cmake_system_linux=true
146 cmake_system_linux=false
149 # Determine whether this is a PA-RISC machine
150 # This only works for Linux or HP-UX, not other PA-RISC OSs (BSD maybe?). Also
151 # may falsely detect parisc on HP-UX m68k
152 cmake_machine_parisc=false
153 if ${cmake_system_linux}; then
154 if uname -m | grep parisc >/dev/null 2>&1; then
155 cmake_machine_parisc=true
157 elif ${cmake_system_hpux}; then
158 if uname -m | grep ia64 >/dev/null 2>&1; then : ; else
159 cmake_machine_parisc=true
163 # Choose the generator to use for bootstrapping.
164 if ${cmake_system_mingw}; then
165 # Bootstrapping from an MSYS prompt.
166 cmake_bootstrap_generator="MSYS Makefiles"
168 # Bootstrapping from a standard UNIX prompt.
169 cmake_bootstrap_generator="Unix Makefiles"
172 # Choose tools and extensions for this platform.
173 if ${cmake_system_openvms}; then
183 # Construct bootstrap directory name.
184 cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
186 # Helper function to fix windows paths.
187 case "${cmake_system}" in
191 cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
197 echo "$1" | sed 's/\\/\//g'
202 # Choose the default install prefix.
203 if ${cmake_system_mingw}; then
204 if [ "x${PROGRAMFILES}" != "x" ]; then
205 cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
206 elif [ "x${ProgramFiles}" != "x" ]; then
207 cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
208 elif [ "x${SYSTEMDRIVE}" != "x" ]; then
209 cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
210 elif [ "x${SystemDrive}" != "x" ]; then
211 cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
213 cmake_default_prefix="c:/Program Files/CMake"
215 elif ${cmake_system_haiku}; then
216 cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
218 cmake_default_prefix="/usr/local"
221 # Lookup default install destinations.
222 cmake_bin_dir_default="`cmake_install_dest_default BIN ${cmake_bin_dir_keyword}`"
223 cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`"
224 cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`"
225 cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`"
226 cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`"
228 CMAKE_KNOWN_C_COMPILERS="cc gcc clang xlc icc tcc"
229 CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ clang++ c++ icc como "
230 CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
232 CMAKE_PROBLEMATIC_FILES="\
235 CMakeCCompiler.cmake \
236 CMakeCXXCompiler.cmake \
237 */CMakeSystem.cmake \
238 */CMakeCCompiler.cmake \
239 */CMakeCXXCompiler.cmake \
240 Source/cmConfigure.h \
241 Source/CTest/Curl/config.h \
242 Utilities/cmexpat/expatConfig.h \
243 Utilities/cmexpat/expatDllConfig.h \
246 CMAKE_UNUSED_SOURCES="\
247 cmGlobalXCodeGenerator \
248 cmLocalXCodeGenerator \
255 cmAddCustomCommandCommand \
256 cmAddCustomTargetCommand \
257 cmAddDefinitionsCommand \
258 cmAddDependenciesCommand \
259 cmAddExecutableCommand \
260 cmAddLibraryCommand \
261 cmAddSubDirectoryCommand \
265 cmBinUtilsLinuxELFGetRuntimeDependenciesTool \
266 cmBinUtilsLinuxELFLinker \
267 cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool \
268 cmBinUtilsMacOSMachOGetRuntimeDependenciesTool \
269 cmBinUtilsMacOSMachOLinker \
270 cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool \
271 cmBinUtilsWindowsPEGetRuntimeDependenciesTool \
272 cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool \
273 cmBinUtilsWindowsPELinker \
274 cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool \
277 cmCMakeMinimumRequired \
278 cmCMakePolicyCommand \
279 cmCPackPropertiesGenerator \
281 cmCheckCustomOutputs \
283 cmCommandArgumentParserHelper \
285 cmCommonTargetGenerator \
286 cmComputeComponentGraph \
287 cmComputeLinkDepends \
288 cmComputeLinkInformation \
289 cmComputeTargetDepends \
290 cmConditionEvaluator \
291 cmConfigureFileCommand \
294 cmCreateTestSourceList \
296 cmCustomCommandGenerator \
297 cmDefinePropertyCommand \
301 cmDocumentationFormatter \
302 cmEnableLanguageCommand \
303 cmEnableTestingCommand \
304 cmExecProgramCommand \
305 cmExecuteProcessCommand \
306 cmExpandedCommandArgument \
307 cmExportBuildFileGenerator \
308 cmExportFileGenerator \
309 cmExportInstallFileGenerator \
311 cmExportTryCompileFileGenerator \
313 cmExternalMakefileProjectGenerator \
323 cmFindLibraryCommand \
324 cmFindPackageCommand \
326 cmFindProgramCommand \
331 cmGeneratedFileStream \
332 cmGeneratorExpression \
333 cmGeneratorExpressionContext \
334 cmGeneratorExpressionDAGChecker \
335 cmGeneratorExpressionEvaluationFile \
336 cmGeneratorExpressionEvaluator \
337 cmGeneratorExpressionLexer \
338 cmGeneratorExpressionNode \
339 cmGeneratorExpressionParser \
341 cmGetCMakePropertyCommand \
342 cmGetDirectoryPropertyCommand \
343 cmGetFilenameComponentCommand \
345 cmGetPropertyCommand \
346 cmGetSourceFilePropertyCommand \
347 cmGetTargetPropertyCommand \
348 cmGetTestPropertyCommand \
349 cmGlobalCommonGenerator \
351 cmGlobalUnixMakefileGenerator3 \
352 cmGlobVerificationManager \
356 cmIncludeGuardCommand \
357 cmIncludeDirectoryCommand \
358 cmIncludeRegularExpressionCommand \
360 cmInstallCommandArguments \
361 cmInstallDirectoryGenerator \
362 cmInstallExportGenerator \
363 cmInstallFilesCommand \
364 cmInstallFilesGenerator \
366 cmInstallScriptGenerator \
367 cmInstallSubdirectoryGenerator \
368 cmInstallTargetGenerator \
369 cmInstallTargetsCommand \
371 cmLDConfigLDConfigTool \
373 cmLinkDirectoriesCommand \
376 cmLinkLineDeviceComputer \
379 cmLocalCommonGenerator \
381 cmLocalUnixMakefileGenerator3 \
382 cmMSVC60LinkLineComputer \
384 cmMakeDirectoryCommand \
386 cmMakefileExecutableTargetGenerator \
387 cmMakefileLibraryTargetGenerator \
388 cmMakefileTargetGenerator \
389 cmMakefileUtilityTargetGenerator \
390 cmMarkAsAdvancedCommand \
395 cmOSXBundleGenerator \
399 cmParseArgumentsCommand \
404 cmPropertyDefinition \
405 cmPropertyDefinitionMap \
408 cmRulePlaceholderExpander \
409 cmRuntimeDependencyArchive \
412 cmSeparateArgumentsCommand \
414 cmSetDirectoryPropertiesCommand \
415 cmSetPropertyCommand \
416 cmSetSourceFilesPropertiesCommand \
417 cmSetTargetPropertiesCommand \
418 cmSetTestsPropertiesCommand \
421 cmSourceFileLocation \
427 cmStringReplaceHelper \
433 cmTargetCompileDefinitionsCommand \
434 cmTargetCompileFeaturesCommand \
435 cmTargetCompileOptionsCommand \
436 cmTargetIncludeDirectoriesCommand \
437 cmTargetLinkLibrariesCommand \
438 cmTargetLinkOptionsCommand \
439 cmTargetPrecompileHeadersCommand \
440 cmTargetPropCommandBase \
441 cmTargetPropertyComputer \
442 cmTargetSourcesCommand \
446 cmTryCompileCommand \
459 if ${cmake_system_mingw}; then
460 CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
461 cmGlobalMSYSMakefileGenerator \
462 cmGlobalMinGWMakefileGenerator \
467 CMAKE_STD_CXX_HEADERS="\
474 CMAKE_STD_CXX_SOURCES="\
478 LexerParser_CXX_SOURCES="\
479 cmCommandArgumentLexer \
480 cmCommandArgumentParser \
485 LexerParser_C_SOURCES="\
489 if ${cmake_system_mingw}; then
520 RegularExpression.hxx \
527 if ${cmake_system_mingw}; then
538 src/win/detect-wakeup.c \
543 src/win/getaddrinfo.c \
544 src/win/getnameinfo.c \
546 src/win/loop-watcher.c \
549 src/win/process-stdio.c \
566 src/unix/cmake-bootstrap.c \
570 src/unix/loop-watcher.c \
571 src/unix/no-fsevents.c \
574 src/unix/posix-hrtime.c \
575 src/unix/posix-poll.c \
582 # Display CMake bootstrap usage
586 Usage: '"$0"' [<options>...] [-- <cmake-options>...]
587 Options: [defaults in brackets after descriptions]
589 --help print this message
590 --version only print version information
591 --verbose display more information
592 --parallel=n bootstrap cmake in parallel, where n is
594 --enable-ccache Enable ccache when building cmake
595 --init=FILE load FILE as script to populate cache
596 --system-libs use all system-installed third-party libraries
597 (for use only by package maintainers)
598 --no-system-libs use all cmake-provided third-party libraries
600 --system-curl use system-installed curl library
601 --no-system-curl use cmake-provided curl library (default)
602 --system-expat use system-installed expat library
603 --no-system-expat use cmake-provided expat library (default)
604 --system-jsoncpp use system-installed jsoncpp library
605 --no-system-jsoncpp use cmake-provided jsoncpp library (default)
606 --system-zlib use system-installed zlib library
607 --no-system-zlib use cmake-provided zlib library (default)
608 --system-bzip2 use system-installed bzip2 library
609 --no-system-bzip2 use cmake-provided bzip2 library (default)
610 --system-liblzma use system-installed liblzma library
611 --no-system-liblzma use cmake-provided liblzma library (default)
612 --system-zstd use system-installed zstd library
613 --no-system-zstd use cmake-provided zstd library (default)
614 --system-libarchive use system-installed libarchive library
615 --no-system-libarchive use cmake-provided libarchive library (default)
616 --system-librhash use system-installed librhash library
617 --no-system-librhash use cmake-provided librhash library (default)
618 --system-libuv use system-installed libuv library
619 --no-system-libuv use cmake-provided libuv library (default)
621 --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
622 --no-qt-gui do not build the Qt-based GUI (default)
623 --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
625 --sphinx-info build Info manual with Sphinx
626 --sphinx-man build man pages with Sphinx
627 --sphinx-html build html help with Sphinx
628 --sphinx-qthelp build qch help with Sphinx
629 --sphinx-build=<sb> use <sb> as the sphinx-build executable
630 --sphinx-flags=<flags> pass <flags> to sphinx-build executable
632 Directory and file names:
633 --prefix=PREFIX install files in tree rooted at PREFIX
634 ['"${cmake_default_prefix}"']
635 --bindir=DIR install binaries in PREFIX/DIR
636 ['"${cmake_bin_dir_default}"']
637 --datadir=DIR install data files in PREFIX/DIR
638 ['"${cmake_data_dir_default}"']
639 --docdir=DIR install documentation files in PREFIX/DIR
640 ['"${cmake_doc_dir_default}"']
641 --mandir=DIR install man pages files in PREFIX/DIR/manN
642 ['"${cmake_man_dir_default}"']
643 --xdgdatadir=DIR install XDG specific files in PREFIX/DIR
644 ['"${cmake_xdgdata_dir_default}"']
649 # Display CMake bootstrap usage
650 cmake_version_display()
652 echo "CMake ${cmake_version}, ${cmake_copyright}"
655 # Display CMake bootstrap error, display the log file and exit
660 echo "---------------------------------------------"
661 echo "Error when bootstrapping CMake:"
663 echo "---------------------------------------------"
664 if [ -f cmake_bootstrap.log ]; then
665 echo "Log of errors: `pwd`/cmake_bootstrap.log"
666 #cat cmake_bootstrap.log
667 echo "---------------------------------------------"
672 cmake_generate_file ()
676 echo "$CONTENT" > "$OUTFILE.tmp"
677 if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then
680 mv -f "$OUTFILE.tmp" "$OUTFILE"
684 # Replace KWSYS_NAMESPACE with cmsys
685 cmake_replace_string ()
691 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
692 sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}"
693 if [ -f "${OUTFILE}${_tmp}" ]; then
694 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
695 #echo "Files are the same"
696 rm -f "${OUTFILE}${_tmp}"
698 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
702 cmake_error 1 "Cannot find file ${INFILE}"
706 cmake_kwsys_config_replace_string ()
712 if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
713 echo "${APPEND}" > "${OUTFILE}${_tmp}"
714 sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
715 s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
716 s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
717 s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
718 s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
719 s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g;
720 s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g;
721 s/@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@/${KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP}/g;
722 }" "${INFILE}" >> "${OUTFILE}${_tmp}"
723 if [ -f "${OUTFILE}${_tmp}" ]; then
724 if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
725 #echo "Files are the same"
726 rm -f "${OUTFILE}${_tmp}"
728 mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
732 cmake_error 2 "Cannot find file ${INFILE}"
735 # Write string into a file
743 # Escape spaces in strings
746 echo $1 | sed "s/ /\\\\ /g"
749 # Encode object file names.
752 echo $1 | sed 's/\//-/g' | sed 's/$/\.o/'
755 # Strip prefix from argument
758 echo "$1" | sed "s/^${2-[^=]*=}//"
761 # Write message to the log
764 echo "$*" >> cmake_bootstrap.log
770 echo "cmake_bootstrap_$$_test"
773 # Run a compiler test. First argument is compiler, second one are compiler
774 # flags, third one is test source file to be compiled
780 if [ ! -f "${TESTFILE}" ]; then
781 echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
784 TMPFILE=`cmake_tmp_file`
785 echo "Try: ${COMPILER}"
786 echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
787 echo "---------- file -----------------------"
789 echo "------------------------------------------"
790 "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
792 if [ "${RES}" -ne "0" ]; then
793 echo "Test failed to compile"
796 if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
797 echo "Test failed to produce executable"
803 if [ "${RES}" -ne "0" ]; then
804 echo "Test produced non-zero return code"
807 echo "Test succeeded"
811 # Run a make test. First argument is the make interpreter.
816 echo "Try: ${MAKE_PROC}"
817 "${MAKE_PROC}" ${MAKE_FLAGS}
819 if [ "${RES}" -ne "0" ]; then
820 echo "${MAKE_PROC} does not work"
823 if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
824 echo "${COMPILER} does not produce output"
830 if [ "${RES}" -ne "0" ]; then
831 echo "${MAKE_PROC} produces strange executable"
834 echo "${MAKE_PROC} works"
841 cmake_ccache_enabled=
842 cmake_prefix_dir="${cmake_default_prefix}"
843 while test $# != 0; do
845 --prefix=*) dir=`cmake_arg "$1"`
846 cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
847 --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
848 --bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;;
849 --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
850 --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
851 --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
852 --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;;
853 --init=*) cmake_init_file=`cmake_arg "$1"` ;;
854 --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
855 --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
856 --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-zstd|--system-libuv)
857 lib=`cmake_arg "$1" "--system-"`
858 cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
859 --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-librhash|--no-system-zlib|--no-system-liblzma|--no-system-zstd|--no-system-libuv)
860 lib=`cmake_arg "$1" "--no-system-"`
861 cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
862 --qt-gui) cmake_bootstrap_qt_gui="1" ;;
863 --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
864 --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
865 --sphinx-info) cmake_sphinx_info="1" ;;
866 --sphinx-man) cmake_sphinx_man="1" ;;
867 --sphinx-html) cmake_sphinx_html="1" ;;
868 --sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
869 --sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
870 --sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
871 --help) cmake_usage ;;
872 --version) cmake_version_display ; exit 2 ;;
873 --verbose) cmake_verbose=TRUE ;;
874 --enable-ccache) cmake_ccache_enabled=TRUE ;;
875 CC=*) CC=`cmake_arg "$1"` ;;
876 CXX=*) CXX=`cmake_arg "$1"` ;;
877 CFLAGS=*) CFLAGS=`cmake_arg "$1"` ;;
878 CXXFLAGS=*) CXXFLAGS=`cmake_arg "$1"` ;;
879 LDFLAGS=*) LDFLAGS=`cmake_arg "$1"` ;;
881 *) die "Unknown option: $1" ;;
886 # If verbose, display some information about bootstrap
887 if [ -n "${cmake_verbose}" ]; then
888 echo "---------------------------------------------"
889 echo "Source directory: ${cmake_source_dir}"
890 echo "Binary directory: ${cmake_binary_dir}"
891 echo "Prefix directory: ${cmake_prefix_dir}"
892 echo "System: ${cmake_system}"
893 if [ "x${cmake_parallel_make}" != "x" ]; then
894 echo "Doing parallel make: ${cmake_parallel_make}"
899 echo "---------------------------------------------"
901 echo "`cmake_version_display`"
903 # Check for in-source build
904 cmake_in_source_build=
905 if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
906 -f "${cmake_binary_dir}/Source/cmake.h" ]; then
907 if [ -n "${cmake_verbose}" ]; then
908 echo "Warning: This is an in-source build"
910 cmake_in_source_build=TRUE
913 # If this is not an in-source build, then Bootstrap stuff should not exist.
914 if [ -z "${cmake_in_source_build}" ]; then
915 # Did somebody bootstrap in the source tree?
916 if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
917 cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
918 Looks like somebody did bootstrap CMake in the source tree, but now you are
919 trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
920 directory from the source tree."
922 # Is there a cache in the source tree?
923 for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
924 if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
925 cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
926 Looks like somebody tried to build CMake in the source tree, but now you are
927 trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
928 from the source tree."
933 # Make bootstrap directory
934 [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
935 if [ ! -d "${cmake_bootstrap_dir}" ]; then
936 cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
938 cd "${cmake_bootstrap_dir}"
940 [ -d "cmsys" ] || mkdir "cmsys"
941 if [ ! -d "cmsys" ]; then
942 cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
945 # Delete all the bootstrap files
946 rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
947 rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
948 rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
950 # If building in-source, remove any cmConfigure.h that may
951 # have been created by a previous run of the bootstrap cmake.
952 if [ -n "${cmake_in_source_build}" ]; then
953 rm -f "${cmake_source_dir}/Source/cmConfigure.h"
956 # If exist compiler flags, set them
957 cmake_c_flags=${CFLAGS}
958 cmake_cxx_flags=${CXXFLAGS}
959 cmake_ld_flags=${LDFLAGS}
961 # Add Cygwin-specific flags
962 if ${cmake_system_cygwin}; then
963 cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
966 # Add CoreFoundation framework on Darwin
967 if ${cmake_system_darwin}; then
968 cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
971 # Add BeOS toolkits...
972 if ${cmake_system_beos}; then
973 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
976 # Add Haiku toolkits...
977 if ${cmake_system_haiku}; then
978 cmake_ld_flags="${LDFLAGS} -lroot -lbe"
981 #-----------------------------------------------------------------------------
982 # Detect known toolchains on some platforms.
984 case "${cmake_system}" in
985 *AIX*) cmake_toolchains='XL GNU' ;;
986 *CYGWIN*) cmake_toolchains='GNU' ;;
987 *Darwin*) cmake_toolchains='Clang GNU' ;;
988 *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
989 *MINGW*) cmake_toolchains='GNU' ;;
992 # Toolchain compiler name table.
993 cmake_toolchain_Clang_CC='clang'
994 cmake_toolchain_Clang_CXX='clang++'
995 cmake_toolchain_GNU_CC='gcc'
996 cmake_toolchain_GNU_CXX='g++'
997 cmake_toolchain_PGI_CC='pgcc'
998 cmake_toolchain_PGI_CXX='pgCC'
999 cmake_toolchain_PathScale_CC='pathcc'
1000 cmake_toolchain_PathScale_CXX='pathCC'
1001 cmake_toolchain_XL_CC='xlc'
1002 cmake_toolchain_XL_CXX='xlC'
1004 cmake_toolchain_try()
1007 TMPFILE=`cmake_tmp_file`
1009 eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
1010 echo 'int main() { return 0; }' > "${TMPFILE}.c"
1011 cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
1013 rm -f "${TMPFILE}.c"
1014 test "${tc_result_CC}" = "0" || return 1
1016 eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
1017 echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
1018 cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
1020 rm -f "${TMPFILE}.cpp"
1021 test "${tc_result_CXX}" = "0" || return 1
1023 cmake_toolchain="$tc"
1026 cmake_toolchain_detect()
1029 for tc in ${cmake_toolchains}; do
1030 echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
1031 cmake_toolchain_try "$tc" &&
1032 echo "Found $tc toolchain" &&
1037 if [ -z "${CC}" -a -z "${CXX}" ]; then
1038 cmake_toolchain_detect
1042 case "${cmake_system}" in
1043 *AIX*) thread_flags='-pthread' ;;
1046 #-----------------------------------------------------------------------------
1050 # If CC is set, use that for compiler, otherwise use list of known compilers
1051 if [ -n "${cmake_toolchain}" ]; then
1052 eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
1053 elif [ -n "${CC}" ]; then
1054 cmake_c_compilers="${CC}"
1056 cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
1059 # Check if C compiler works
1060 TMPFILE=`cmake_tmp_file`
1063 # error "The CMAKE_C_COMPILER is set to a C++ compiler"
1066 #if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
1067 #error "On AIX with GNU we need the -pthread flag."
1070 #if defined(__sun) && __STDC_VERSION__ < 199901L
1071 #error "On Solaris we need C99."
1074 #if defined(__hpux) && !(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 409)
1075 #error "On HP-UX we need GCC 4.9 or higher."
1080 int main(int argc, char* argv[])
1082 printf("%d%c", (argv != 0), (char)0x0a);
1086 for std in 11 99 90; do
1087 std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
1088 for compiler in ${cmake_c_compilers}; do
1089 for std_flag in '' $std_flags; do
1090 for thread_flag in '' $thread_flags; do
1091 echo "Checking whether '${compiler} ${cmake_c_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
1092 if cmake_try_run "${compiler}" "${cmake_c_flags} ${std_flag} ${thread_flag}" \
1093 "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
1094 cmake_c_compiler="${compiler}"
1095 cmake_c_flags="${cmake_c_flags} ${std_flag} ${thread_flag}"
1102 rm -f "${TMPFILE}.c"
1104 if [ -z "${cmake_c_compiler}" ]; then
1105 cmake_error 6 "Cannot find appropriate C compiler on this system.
1106 Please specify one using environment variable CC.
1107 See cmake_bootstrap.log for compilers attempted.
1110 echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
1112 #-----------------------------------------------------------------------------
1116 # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
1118 # If CC is set, use that for compiler, otherwise use list of known compilers
1119 if [ -n "${cmake_toolchain}" ]; then
1120 eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
1121 elif [ -n "${CXX}" ]; then
1122 cmake_cxx_compilers="${CXX}"
1124 cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
1127 # Check if C++ compiler works
1128 TMPFILE=`cmake_tmp_file`
1132 #include <unordered_map>
1134 #if __cplusplus < 201103L
1135 #error "Compiler is not in a mode aware of C++11."
1138 #if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
1139 #error "On AIX with GNU we need the -pthread flag."
1142 #if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
1143 #error "SunPro <= 5.13 mode not supported due to bug in move semantics."
1146 #if defined(__hpux) && !(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 409)
1147 #error "On HP-UX we need GCC 4.9 or higher."
1150 #if __cplusplus > 201103L
1154 int a[] = { 0, 1, 2 };
1155 auto ai = std::cbegin(a);
1157 int b[] = { 2, 1, 0 };
1158 auto bi = std::cend(b);
1160 return *ai + *(bi - 1);
1169 #if __cplusplus >= 201703L
1173 std::optional<int> oi = 0;
1186 int Get() const { return this->Member; }
1192 auto const c = std::unique_ptr<Class>(new Class);
1193 std::cout << c->Get() << check_cxx14() << check_cxx17() << std::endl;
1196 ' > "${TMPFILE}.cxx"
1197 for std in 17 14 11; do
1198 std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
1199 for compiler in ${cmake_cxx_compilers}; do
1200 for std_flag in '' $std_flags; do
1201 for thread_flag in '' $thread_flags; do
1202 echo "Checking whether '${compiler} ${cmake_cxx_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
1203 if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${std_flag} ${thread_flag}" \
1204 "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
1205 cmake_cxx_compiler="${compiler}"
1206 cmake_cxx_flags="${cmake_cxx_flags} ${std_flag} ${thread_flag} "
1213 rm -f "${TMPFILE}.cxx"
1215 if [ -z "${cmake_cxx_compiler}" ]; then
1216 cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
1217 Please specify one using environment variable CXX.
1218 The C++ flags are \"$cmake_cxx_flags\".
1219 They can be changed using the environment variable CXXFLAGS.
1220 See cmake_bootstrap.log for compilers attempted."
1222 echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
1224 #-----------------------------------------------------------------------------
1227 cmake_make_processor=
1230 # If MAKE is set, use that for make processor, otherwise use list of known make
1231 if [ -n "${MAKE}" ]; then
1232 cmake_make_processors="${MAKE}"
1234 cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
1237 TMPFILE="`cmake_tmp_file`_dir"
1238 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
1239 mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
1240 cd "${cmake_bootstrap_dir}/${TMPFILE}"
1243 "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
1247 int main(){ printf("1%c", (char)0x0a); return 0; }
1249 cmake_original_make_flags="${cmake_make_flags}"
1250 if [ "x${cmake_parallel_make}" != "x" ]; then
1251 cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
1253 for a in ${cmake_make_processors}; do
1254 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
1255 cmake_make_processor="${a}"
1258 cmake_full_make_flags="${cmake_make_flags}"
1259 if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
1260 if [ -z "${cmake_make_processor}" ]; then
1261 cmake_make_flags="${cmake_original_make_flags}"
1262 for a in ${cmake_make_processors}; do
1263 if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
1264 cmake_make_processor="${a}"
1269 cd "${cmake_bootstrap_dir}"
1271 if [ -z "${cmake_make_processor}" ]; then
1272 cmake_error 8 "Cannot find appropriate Makefile processor on this system.
1273 Please specify one using environment variable MAKE."
1275 rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
1276 echo "Makefile processor on this system is: ${cmake_make_processor}"
1277 if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
1278 echo "---------------------------------------------"
1279 echo "Makefile processor ${cmake_make_processor} does not support parallel build"
1280 echo "---------------------------------------------"
1283 # Test for kwsys features
1284 KWSYS_NAME_IS_KWSYS=0
1285 KWSYS_BUILD_SHARED=0
1286 KWSYS_LFS_AVAILABLE=0
1287 KWSYS_LFS_REQUESTED=0
1288 KWSYS_STL_HAS_WSTRING=0
1289 KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=0
1290 KWSYS_CXX_HAS_SETENV=0
1291 KWSYS_CXX_HAS_UNSETENV=0
1292 KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
1293 KWSYS_CXX_HAS_UTIMENSAT=0
1294 KWSYS_CXX_HAS_UTIMES=0
1295 KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP=1
1297 if cmake_try_run "${cmake_cxx_compiler}" \
1298 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
1299 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1300 KWSYS_CXX_HAS_SETENV=1
1301 echo "${cmake_cxx_compiler} has setenv"
1303 echo "${cmake_cxx_compiler} does not have setenv"
1306 if cmake_try_run "${cmake_cxx_compiler}" \
1307 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
1308 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1309 KWSYS_CXX_HAS_UNSETENV=1
1310 echo "${cmake_cxx_compiler} has unsetenv"
1312 echo "${cmake_cxx_compiler} does not have unsetenv"
1315 if cmake_try_run "${cmake_cxx_compiler}" \
1316 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
1317 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1318 KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
1319 echo "${cmake_cxx_compiler} has environ in stdlib.h"
1321 echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
1324 if cmake_try_run "${cmake_cxx_compiler}" \
1325 "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_WSTRING" \
1326 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1327 KWSYS_STL_HAS_WSTRING=1
1328 echo "${cmake_cxx_compiler} has stl wstring"
1330 echo "${cmake_cxx_compiler} does not have stl wstring"
1333 if cmake_try_run "${cmake_cxx_compiler}" \
1334 "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H" \
1335 "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
1336 KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=1
1337 echo "${cmake_cxx_compiler} has <ext/stdio_filebuf.h>"
1339 echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>"
1342 if [ -n "${cmake_ccache_enabled}" ]; then
1343 echo "Building CMake with ccache"
1344 cmake_c_compiler="ccache ${cmake_c_compiler}"
1345 cmake_cxx_compiler="ccache ${cmake_cxx_compiler}"
1348 # Just to be safe, let us store compiler and flags to the header file
1350 cmake_bootstrap_version='$Revision$'
1351 cmake_compiler_settings_comment="/*
1352 * Generated by ${cmake_source_dir}/bootstrap
1353 * Version: ${cmake_bootstrap_version}
1355 * Source directory: ${cmake_source_dir}
1356 * Binary directory: ${cmake_bootstrap_dir}
1358 * C compiler: ${cmake_c_compiler}
1359 * C flags: ${cmake_c_flags}
1361 * C++ compiler: ${cmake_cxx_compiler}
1362 * C++ flags: ${cmake_cxx_flags}
1364 * Make: ${cmake_make_processor}
1367 * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
1369 * ${CMAKE_STD_CXX_HEADERS} ${CMAKE_STD_CXX_SOURCES}
1370 * LexerParser Sources:
1371 * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES}
1373 * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
1375 * ${LIBUV_C_SOURCES}
1379 cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
1381 # When bootstrapping on MinGW with MSYS we must convert the source
1382 # directory to a windows path.
1383 if ${cmake_system_mingw}; then
1384 CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W`
1385 CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W`
1387 CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}"
1388 CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}"
1391 # Write CMake version
1392 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
1393 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
1394 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
1395 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
1396 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\""
1397 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\""
1398 cmake_report cmConfigure.h${_tmp} "#define CMake_DEFAULT_RECURSION_LIMIT 400"
1399 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
1400 cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
1401 cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
1403 if ${cmake_system_mingw}; then
1404 cmake_report cmConfigure.h${_tmp} "#if defined(_WIN32) && !defined(NOMINMAX)"
1405 cmake_report cmConfigure.h${_tmp} "# define NOMINMAX"
1406 cmake_report cmConfigure.h${_tmp} "#endif"
1409 # Regenerate configured headers
1410 for h in Configure VersionConfig; do
1411 if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
1412 rm -f cm${h}.h${_tmp}
1414 mv -f cm${h}.h${_tmp} cm${h}.h
1419 cmake_kwsys_config_replace_string \
1420 "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
1421 "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
1422 "${cmake_compiler_settings_comment}"
1423 cmake_kwsys_config_replace_string \
1424 "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
1425 "${cmake_bootstrap_dir}/cmsys/Configure.h" \
1426 "${cmake_compiler_settings_comment}"
1428 for a in ${KWSYS_FILES}; do
1429 cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
1430 "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
1433 cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" ""
1436 dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.hxx `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
1437 for h in ${CMAKE_STD_CXX_HEADERS}; do
1438 dep="${dep} `cmake_escape \"${cmake_source_dir}\"`/Utilities/std/cm/${h}"
1441 for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${CMAKE_STD_CXX_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
1442 objs="${objs} ${a}.o"
1444 for a in ${LIBUV_C_SOURCES}; do
1445 objs="${objs} uv-`cmake_obj ${a}`"
1451 if ${cmake_system_mingw}; then
1452 uv_c_flags="${uv_c_flags} -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600"
1453 libs="${libs} -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -lole32 -loleaut32"
1455 case "${cmake_system}" in
1457 uv_c_flags="${uv_c_flags} -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT"
1458 libs="${libs} -lperfstat"
1461 uv_c_flags="${uv_c_flags} -D_DARWIN_USE_64_BIT_INODE=1 -D_DARWIN_UNLIMITED_SELECT=1"
1464 uv_c_flags="${uv_c_flags} -D_XOPEN_SOURCE_EXTENDED"
1467 uv_c_flags="${uv_c_flags} -D_GNU_SOURCE"
1468 libs="${libs} -ldl -lrt"
1471 libs="${libs} -lkvm -lfreebsd-glue"
1474 libs="${libs} -lkvm"
1477 # Normally libuv uses '-D_XOPEN_SOURCE=500 -std=c90' on Solaris 5.10,
1478 # but we do not need to do that because we bootstrap using POSIX APIs.
1479 uv_c_flags="${uv_c_flags} -D__EXTENSIONS__ -D_XOPEN_SOURCE=600"
1480 libs="${libs} -lkstat -lnsl -lsendfile -lsocket -lrt"
1484 uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/include"`"
1485 if ${cmake_system_mingw}; then
1486 uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src/win"`"
1488 uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src/unix"`"
1490 uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src"`"
1492 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
1493 cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
1496 if [ "x${cmake_c_flags}" != "x" ]; then
1497 cmake_c_flags="${cmake_c_flags} "
1500 if [ "x${cmake_cxx_flags}" != "x" ]; then
1501 cmake_cxx_flags="${cmake_cxx_flags} "
1504 cmake_c_flags_String="-DKWSYS_STRING_C"
1505 if ${cmake_system_mingw}; then
1506 cmake_c_flags_EncodingC="-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_ACP"
1507 cmake_cxx_flags_EncodingCXX="${cmake_c_flags_EncodingC}"
1508 cmake_cxx_flags_cmProcessOutput="${cmake_c_flags_EncodingC}"
1510 cmake_cxx_flags_SystemTools="
1511 -DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
1512 -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
1513 -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
1514 -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
1515 -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
1517 cmake_c_flags="${cmake_c_flags} \
1519 -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
1520 -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1521 -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
1522 -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
1523 cmake_cxx_flags="${cmake_cxx_flags} \
1525 -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
1526 -I`cmake_escape \"${cmake_source_dir}/Source\"` \
1527 -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
1528 -I`cmake_escape \"${cmake_source_dir}/Utilities/std\"` \
1529 -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
1530 echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
1531 echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} ${libs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
1532 for a in ${CMAKE_CXX_SOURCES}; do
1533 src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
1534 src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1535 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1536 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1538 for a in ${CMAKE_C_SOURCES}; do
1539 src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
1540 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1541 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1543 for a in ${CMAKE_STD_CXX_SOURCES}; do
1544 src=`cmake_escape "${cmake_source_dir}/Utilities/std/cm/bits/${a}.cxx"`
1545 src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1546 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1547 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1549 for a in ${LexerParser_CXX_SOURCES}; do
1550 src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.cxx"`
1551 src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1552 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1553 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1555 for a in ${LexerParser_C_SOURCES}; do
1556 src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.c"`
1557 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1558 echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1560 for a in ${KWSYS_C_SOURCES}; do
1561 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
1562 src_flags=`eval echo \\${cmake_c_flags_\${a}}`
1563 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1564 echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1566 for a in ${KWSYS_CXX_SOURCES}; do
1567 src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
1568 src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
1569 echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1570 echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
1572 for a in ${LIBUV_C_SOURCES}; do
1573 src=`cmake_escape "${cmake_source_dir}/Utilities/cmlibuv/${a}"`
1574 echo "uv-`cmake_obj ${a}` : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
1575 echo " ${cmake_c_compiler} ${cmake_c_flags} ${uv_c_flags} -c ${src} -o uv-`cmake_obj ${a}`" >> "${cmake_bootstrap_dir}/Makefile"
1579 cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
1580 ' >> "${cmake_bootstrap_dir}/Makefile"
1582 # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
1584 # Generated by '"${cmake_source_dir}"'/bootstrap
1585 # Default cmake settings. These may be overridden any settings below.
1586 set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
1587 set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
1588 set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
1589 set (CMAKE_BIN_DIR "'"${cmake_bin_dir}"'" CACHE PATH "Install location for binaries (relative to prefix)." FORCE)
1590 set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
1591 set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE)
1592 ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1594 # Add configuration settings given as command-line options.
1595 if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
1597 set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
1598 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1600 if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
1602 set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
1603 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1605 if [ "x${cmake_sphinx_info}" != "x" ]; then
1607 set (SPHINX_INFO "'"${cmake_sphinx_info}"'" CACHE BOOL "Build Info manual with Sphinx" FORCE)
1608 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1610 if [ "x${cmake_sphinx_man}" != "x" ]; then
1612 set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE)
1613 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1615 if [ "x${cmake_sphinx_html}" != "x" ]; then
1617 set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE)
1618 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1620 if [ "x${cmake_sphinx_qthelp}" != "x" ]; then
1622 set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
1623 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1625 if [ "x${cmake_sphinx_build}" != "x" ]; then
1627 set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
1628 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1630 if [ "x${cmake_sphinx_flags}" != "x" ]; then
1632 set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
1633 ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1636 # Add user-specified settings. Handle relative-path case for
1637 # specification of cmake_init_file.
1639 cd "${cmake_binary_dir}"
1640 if [ -f "${cmake_init_file}" ]; then
1641 cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
1645 echo "---------------------------------------------"
1647 # Run make to build bootstrap cmake
1648 if [ "x${cmake_parallel_make}" != "x" ]; then
1649 ${cmake_make_processor} ${cmake_make_flags}
1651 ${cmake_make_processor}
1654 if [ "${RES}" -ne "0" ]; then
1655 cmake_error 9 "Problem while running ${cmake_make_processor}"
1657 cd "${cmake_binary_dir}"
1659 # Set C, CXX, and MAKE environment variables, so that real real cmake will be
1660 # build with same compiler and make
1661 CC="${cmake_c_compiler}"
1662 CXX="${cmake_cxx_compiler}"
1663 MAKE="${cmake_make_processor}"
1671 # Run bootstrap CMake to configure real CMake
1672 cmake_options="-DCMAKE_BOOTSTRAP=1"
1673 if [ -n "${cmake_verbose}" ]; then
1674 cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
1676 "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
1678 if [ "${RES}" -ne "0" ]; then
1679 cmake_error 11 "Problem while running initial CMake"
1682 echo "---------------------------------------------"
1684 # And we are done. Now just run make
1685 echo "CMake has bootstrapped. Now run ${cmake_make_processor}."