bootstrap 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532
  1. #!/bin/sh
  2. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  3. # file Copyright.txt or https://cmake.org/licensing for details.
  4. die() {
  5. echo "$@" 1>&2 ; exit 1
  6. }
  7. # Compile flag extraction function.
  8. cmake_extract_standard_flags()
  9. {
  10. sed -n "s/ *set *( *CMAKE_${2}${3}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
  11. "${cmake_source_dir}/Modules/Compiler/"${1:-*}-${2}.cmake 2>/dev/null | tr ';' ' '
  12. }
  13. # Version number extraction function.
  14. cmake_version_component()
  15. {
  16. sed -n "
  17. /^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
  18. " "${cmake_source_dir}/Source/CMakeVersion.cmake"
  19. }
  20. # Install destination extraction function.
  21. cmake_install_dest_default()
  22. {
  23. sed -n '
  24. /^ *set(CMAKE_'"${1}"'_DIR_DEFAULT.*) # '"${2}"'$/ {
  25. s/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT *"\([^"]*\)").*$/\1/
  26. s/${CMake_VERSION_MAJOR}/'"${cmake_version_major}"'/
  27. s/${CMake_VERSION_MINOR}/'"${cmake_version_minor}"'/
  28. s/${CMake_VERSION_PATCH}/'"${cmake_version_patch}"'/
  29. p
  30. q
  31. }
  32. ' "${cmake_source_dir}/Source/CMakeInstallDestinations.cmake"
  33. }
  34. cmake_toupper()
  35. {
  36. echo "$1" | tr '[:lower:]' '[:upper:]'
  37. }
  38. # Detect system and directory information.
  39. cmake_system=`uname`
  40. cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
  41. cmake_binary_dir=`pwd`
  42. # Load version information.
  43. cmake_version_major="`cmake_version_component MAJOR`"
  44. cmake_version_minor="`cmake_version_component MINOR`"
  45. cmake_version_patch="`cmake_version_component PATCH`"
  46. cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
  47. cmake_version_rc="`cmake_version_component RC`"
  48. if [ "$cmake_version_rc" != "" ]; then
  49. cmake_version="${cmake_version}-rc${cmake_version_rc}"
  50. fi
  51. cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.txt"`"
  52. cmake_bin_dir_keyword="OTHER"
  53. cmake_data_dir_keyword="OTHER"
  54. cmake_doc_dir_keyword="OTHER"
  55. cmake_man_dir_keyword="OTHER"
  56. cmake_xdgdata_dir_keyword="OTHER"
  57. cmake_bin_dir=""
  58. cmake_data_dir=""
  59. cmake_doc_dir=""
  60. cmake_man_dir=""
  61. cmake_xdgdata_dir=""
  62. cmake_init_file=""
  63. cmake_bootstrap_system_libs=""
  64. cmake_bootstrap_qt_gui=""
  65. cmake_bootstrap_qt_qmake=""
  66. cmake_sphinx_man=""
  67. cmake_sphinx_html=""
  68. cmake_sphinx_qthelp=""
  69. cmake_sphinx_build=""
  70. cmake_sphinx_flags=""
  71. # Determine whether this is a Cygwin environment.
  72. if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
  73. cmake_system_cygwin=true
  74. cmake_doc_dir_keyword="CYGWIN"
  75. cmake_man_dir_keyword="CYGWIN"
  76. else
  77. cmake_system_cygwin=false
  78. fi
  79. # Determine whether this is a MinGW environment.
  80. if echo "${cmake_system}" | grep 'MINGW\|MSYS' >/dev/null 2>&1; then
  81. cmake_system_mingw=true
  82. else
  83. cmake_system_mingw=false
  84. fi
  85. # Determine whether this is OS X
  86. if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
  87. cmake_system_darwin=true
  88. else
  89. cmake_system_darwin=false
  90. fi
  91. # Determine whether this is BeOS
  92. if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
  93. cmake_system_beos=true
  94. cmake_doc_dir_keyword="HAIKU"
  95. cmake_man_dir_keyword="HAIKU"
  96. else
  97. cmake_system_beos=false
  98. fi
  99. # Determine whether this is Haiku
  100. if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
  101. cmake_system_haiku=true
  102. cmake_doc_dir_keyword="HAIKU"
  103. cmake_man_dir_keyword="HAIKU"
  104. else
  105. cmake_system_haiku=false
  106. fi
  107. # Determine whether this is OpenVMS
  108. if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
  109. cmake_system_openvms=true
  110. else
  111. cmake_system_openvms=false
  112. fi
  113. # Determine whether this is HP-UX
  114. if echo "${cmake_system}" | grep HP-UX >/dev/null 2>&1; then
  115. die 'CMake no longer compiles on HP-UX. See
  116. https://gitlab.kitware.com/cmake/cmake/issues/17137
  117. Use CMake 3.9 or lower instead.'
  118. cmake_system_hpux=true
  119. else
  120. cmake_system_hpux=false
  121. fi
  122. # Determine whether this is Linux
  123. if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
  124. cmake_system_linux=true
  125. else
  126. cmake_system_linux=false
  127. fi
  128. # Determine whether this is a PA-RISC machine
  129. # This only works for Linux or HP-UX, not other PA-RISC OSs (BSD maybe?). Also
  130. # may falsely detect parisc on HP-UX m68k
  131. cmake_machine_parisc=false
  132. if ${cmake_system_linux}; then
  133. if uname -m | grep parisc >/dev/null 2>&1; then
  134. cmake_machine_parisc=true
  135. fi
  136. elif ${cmake_system_hpux}; then
  137. if uname -m | grep ia64 >/dev/null 2>&1; then : ; else
  138. cmake_machine_parisc=true
  139. fi
  140. fi
  141. # Choose the generator to use for bootstrapping.
  142. if ${cmake_system_mingw}; then
  143. # Bootstrapping from an MSYS prompt.
  144. cmake_bootstrap_generator="MSYS Makefiles"
  145. else
  146. # Bootstrapping from a standard UNIX prompt.
  147. cmake_bootstrap_generator="Unix Makefiles"
  148. fi
  149. # Choose tools and extensions for this platform.
  150. if ${cmake_system_openvms}; then
  151. _tmp="_tmp"
  152. _cmk="_cmk"
  153. _diff=`which diff`
  154. else
  155. _tmp=".tmp"
  156. _cmk=".cmk"
  157. _diff="diff"
  158. fi
  159. # Construct bootstrap directory name.
  160. cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
  161. # Helper function to fix windows paths.
  162. case "${cmake_system}" in
  163. *MINGW*)
  164. cmake_fix_slashes()
  165. {
  166. cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
  167. }
  168. ;;
  169. *)
  170. cmake_fix_slashes()
  171. {
  172. echo "$1" | sed 's/\\/\//g'
  173. }
  174. ;;
  175. esac
  176. # Choose the default install prefix.
  177. if ${cmake_system_mingw}; then
  178. if [ "x${PROGRAMFILES}" != "x" ]; then
  179. cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
  180. elif [ "x${ProgramFiles}" != "x" ]; then
  181. cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
  182. elif [ "x${SYSTEMDRIVE}" != "x" ]; then
  183. cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
  184. elif [ "x${SystemDrive}" != "x" ]; then
  185. cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
  186. else
  187. cmake_default_prefix="c:/Program Files/CMake"
  188. fi
  189. elif ${cmake_system_haiku}; then
  190. cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
  191. else
  192. cmake_default_prefix="/usr/local"
  193. fi
  194. # Lookup default install destinations.
  195. cmake_bin_dir_default="`cmake_install_dest_default BIN ${cmake_bin_dir_keyword}`"
  196. cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`"
  197. cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`"
  198. cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`"
  199. cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`"
  200. CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
  201. CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
  202. CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
  203. CMAKE_PROBLEMATIC_FILES="\
  204. CMakeCache.txt \
  205. CMakeSystem.cmake \
  206. CMakeCCompiler.cmake \
  207. CMakeCXXCompiler.cmake \
  208. */CMakeSystem.cmake \
  209. */CMakeCCompiler.cmake \
  210. */CMakeCXXCompiler.cmake \
  211. Source/cmConfigure.h \
  212. Source/CTest/Curl/config.h \
  213. Utilities/cmexpat/expatConfig.h \
  214. Utilities/cmexpat/expatDllConfig.h \
  215. "
  216. CMAKE_UNUSED_SOURCES="\
  217. cmGlobalXCodeGenerator \
  218. cmLocalXCodeGenerator \
  219. cmXCodeObject \
  220. cmXCode21Object \
  221. cmSourceGroup \
  222. "
  223. CMAKE_CXX_SOURCES="\
  224. cmAddCustomCommandCommand \
  225. cmAddCustomTargetCommand \
  226. cmAddDefinitionsCommand \
  227. cmAddDependenciesCommand \
  228. cmAddExecutableCommand \
  229. cmAddLibraryCommand \
  230. cmAddSubDirectoryCommand \
  231. cmAddTestCommand \
  232. cmBreakCommand \
  233. cmBuildCommand \
  234. cmCMakeMinimumRequired \
  235. cmCMakePolicyCommand \
  236. cmCPackPropertiesGenerator \
  237. cmCacheManager \
  238. cmCommand \
  239. cmCommandArgumentParserHelper \
  240. cmCommandArgumentsHelper \
  241. cmCommands \
  242. cmCommonTargetGenerator \
  243. cmComputeComponentGraph \
  244. cmComputeLinkDepends \
  245. cmComputeLinkInformation \
  246. cmComputeTargetDepends \
  247. cmConditionEvaluator \
  248. cmConfigureFileCommand \
  249. cmContinueCommand \
  250. cmCoreTryCompile \
  251. cmCreateTestSourceList \
  252. cmCustomCommand \
  253. cmCustomCommandGenerator \
  254. cmDefinePropertyCommand \
  255. cmDefinitions \
  256. cmDepends \
  257. cmDependsC \
  258. cmDisallowedCommand \
  259. cmDocumentationFormatter \
  260. cmEnableLanguageCommand \
  261. cmEnableTestingCommand \
  262. cmExecProgramCommand \
  263. cmExecuteProcessCommand \
  264. cmExpandedCommandArgument \
  265. cmExportBuildFileGenerator \
  266. cmExportFileGenerator \
  267. cmExportInstallFileGenerator \
  268. cmExportSet \
  269. cmExportSetMap \
  270. cmExportTryCompileFileGenerator \
  271. cmExprParserHelper \
  272. cmExternalMakefileProjectGenerator \
  273. cmFileCommand \
  274. cmFileTimeComparison \
  275. cmFindBase \
  276. cmFindCommon \
  277. cmFindFileCommand \
  278. cmFindLibraryCommand \
  279. cmFindPackageCommand \
  280. cmFindPathCommand \
  281. cmFindProgramCommand \
  282. cmForEachCommand \
  283. cmFunctionCommand \
  284. cmFSPermissions \
  285. cmGeneratedFileStream \
  286. cmGeneratorExpression \
  287. cmGeneratorExpressionContext \
  288. cmGeneratorExpressionDAGChecker \
  289. cmGeneratorExpressionEvaluationFile \
  290. cmGeneratorExpressionEvaluator \
  291. cmGeneratorExpressionLexer \
  292. cmGeneratorExpressionNode \
  293. cmGeneratorExpressionParser \
  294. cmGeneratorTarget \
  295. cmGetCMakePropertyCommand \
  296. cmGetDirectoryPropertyCommand \
  297. cmGetFilenameComponentCommand \
  298. cmGetPropertyCommand \
  299. cmGetSourceFilePropertyCommand \
  300. cmGetTargetPropertyCommand \
  301. cmGetTestPropertyCommand \
  302. cmGlobalCommonGenerator \
  303. cmGlobalGenerator \
  304. cmGlobalUnixMakefileGenerator3 \
  305. cmHexFileConverter \
  306. cmIfCommand \
  307. cmIncludeCommand \
  308. cmIncludeGuardCommand \
  309. cmIncludeDirectoryCommand \
  310. cmIncludeRegularExpressionCommand \
  311. cmInstallCommand \
  312. cmInstallCommandArguments \
  313. cmInstallDirectoryGenerator \
  314. cmInstallExportGenerator \
  315. cmInstallFilesCommand \
  316. cmInstallFilesGenerator \
  317. cmInstallGenerator \
  318. cmInstallScriptGenerator \
  319. cmInstallTargetGenerator \
  320. cmInstallTargetsCommand \
  321. cmInstalledFile \
  322. cmLinkDirectoriesCommand \
  323. cmLinkLineComputer \
  324. cmListCommand \
  325. cmListFileCache \
  326. cmLocalCommonGenerator \
  327. cmLocalGenerator \
  328. cmLocalUnixMakefileGenerator3 \
  329. cmMSVC60LinkLineComputer \
  330. cmMacroCommand \
  331. cmMakeDirectoryCommand \
  332. cmMakefile \
  333. cmMakefileExecutableTargetGenerator \
  334. cmMakefileLibraryTargetGenerator \
  335. cmMakefileTargetGenerator \
  336. cmMakefileUtilityTargetGenerator \
  337. cmMarkAsAdvancedCommand \
  338. cmMathCommand \
  339. cmMessageCommand \
  340. cmMessenger \
  341. cmNewLineStyle \
  342. cmOSXBundleGenerator \
  343. cmOptionCommand \
  344. cmOrderDirectories \
  345. cmOutputConverter \
  346. cmParseArgumentsCommand \
  347. cmPathLabel \
  348. cmPolicies \
  349. cmProcessOutput \
  350. cmProjectCommand \
  351. cmProperty \
  352. cmPropertyDefinition \
  353. cmPropertyDefinitionMap \
  354. cmPropertyMap \
  355. cmReturnCommand \
  356. cmRulePlaceholderExpander \
  357. cmScriptGenerator \
  358. cmSearchPath \
  359. cmSeparateArgumentsCommand \
  360. cmSetCommand \
  361. cmSetDirectoryPropertiesCommand \
  362. cmSetPropertyCommand \
  363. cmSetSourceFilesPropertiesCommand \
  364. cmSetTargetPropertiesCommand \
  365. cmSetTestsPropertiesCommand \
  366. cmSiteNameCommand \
  367. cmSourceFile \
  368. cmSourceFileLocation \
  369. cmState \
  370. cmStateDirectory \
  371. cmStateSnapshot \
  372. cmStringCommand \
  373. cmSubdirCommand \
  374. cmSystemTools \
  375. cmTarget \
  376. cmTargetCompileDefinitionsCommand \
  377. cmTargetCompileFeaturesCommand \
  378. cmTargetCompileOptionsCommand \
  379. cmTargetIncludeDirectoriesCommand \
  380. cmTargetLinkLibrariesCommand \
  381. cmTargetPropCommandBase \
  382. cmTargetPropertyComputer \
  383. cmTargetSourcesCommand \
  384. cmTest \
  385. cmTestGenerator \
  386. cmTimestamp \
  387. cmTryCompileCommand \
  388. cmTryRunCommand \
  389. cmUnexpectedCommand \
  390. cmUnsetCommand \
  391. cmVersion \
  392. cmWhileCommand \
  393. cmWorkingDirectory \
  394. cmake \
  395. cmakemain \
  396. cmcmd \
  397. "
  398. if ${cmake_system_mingw}; then
  399. CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
  400. cmGlobalMSYSMakefileGenerator \
  401. cmGlobalMinGWMakefileGenerator"
  402. fi
  403. LexerParser_CXX_SOURCES="\
  404. cmCommandArgumentLexer \
  405. cmCommandArgumentParser \
  406. cmExprLexer \
  407. cmExprParser \
  408. "
  409. LexerParser_C_SOURCES="\
  410. cmListFileLexer \
  411. "
  412. if ${cmake_system_mingw}; then
  413. KWSYS_C_SOURCES="\
  414. EncodingC \
  415. ProcessWin32 \
  416. String \
  417. System \
  418. Terminal"
  419. else
  420. KWSYS_C_SOURCES="\
  421. EncodingC \
  422. ProcessUNIX \
  423. String \
  424. System \
  425. Terminal"
  426. fi
  427. KWSYS_CXX_SOURCES="\
  428. Directory \
  429. EncodingCXX \
  430. FStream \
  431. Glob \
  432. RegularExpression \
  433. SystemTools"
  434. KWSYS_FILES="\
  435. Directory.hxx \
  436. Encoding.h \
  437. Encoding.hxx \
  438. FStream.hxx \
  439. Glob.hxx \
  440. Process.h \
  441. RegularExpression.hxx \
  442. String.h \
  443. String.hxx \
  444. System.h \
  445. SystemTools.hxx \
  446. Terminal.h"
  447. if ${cmake_system_mingw}; then
  448. LIBUV_C_SOURCES="\
  449. src/fs-poll.c \
  450. src/inet.c \
  451. src/threadpool.c \
  452. src/uv-common.c \
  453. src/win/async.c \
  454. src/win/core.c \
  455. src/win/detect-wakeup.c \
  456. src/win/dl.c \
  457. src/win/error.c \
  458. src/win/fs-event.c \
  459. src/win/fs.c \
  460. src/win/getaddrinfo.c \
  461. src/win/getnameinfo.c \
  462. src/win/handle.c \
  463. src/win/loop-watcher.c \
  464. src/win/pipe.c \
  465. src/win/poll.c \
  466. src/win/process-stdio.c \
  467. src/win/process.c \
  468. src/win/req.c \
  469. src/win/signal.c \
  470. src/win/stream.c \
  471. src/win/tcp.c \
  472. src/win/thread.c \
  473. src/win/timer.c \
  474. src/win/tty.c \
  475. src/win/udp.c \
  476. src/win/util.c \
  477. src/win/winapi.c \
  478. src/win/winsock.c \
  479. "
  480. else
  481. LIBUV_C_SOURCES="\
  482. src/uv-common.c \
  483. src/unix/cmake-bootstrap.c \
  484. src/unix/core.c \
  485. src/unix/fs.c \
  486. src/unix/loop.c \
  487. src/unix/loop-watcher.c \
  488. src/unix/no-fsevents.c \
  489. src/unix/pipe.c \
  490. src/unix/poll.c \
  491. src/unix/posix-hrtime.c \
  492. src/unix/posix-poll.c \
  493. src/unix/process.c \
  494. src/unix/signal.c \
  495. src/unix/stream.c \
  496. src/unix/timer.c \
  497. "
  498. fi
  499. # Display CMake bootstrap usage
  500. cmake_usage()
  501. {
  502. echo '
  503. Usage: '"$0"' [<options>...] [-- <cmake-options>...]
  504. Options: [defaults in brackets after descriptions]
  505. Configuration:
  506. --help print this message
  507. --version only print version information
  508. --verbose display more information
  509. --parallel=n bootstrap cmake in parallel, where n is
  510. number of nodes [1]
  511. --enable-ccache Enable ccache when building cmake
  512. --init=FILE load FILE as script to populate cache
  513. --system-libs use all system-installed third-party libraries
  514. (for use only by package maintainers)
  515. --no-system-libs use all cmake-provided third-party libraries
  516. (default)
  517. --system-curl use system-installed curl library
  518. --no-system-curl use cmake-provided curl library (default)
  519. --system-expat use system-installed expat library
  520. --no-system-expat use cmake-provided expat library (default)
  521. --system-jsoncpp use system-installed jsoncpp library
  522. --no-system-jsoncpp use cmake-provided jsoncpp library (default)
  523. --system-zlib use system-installed zlib library
  524. --no-system-zlib use cmake-provided zlib library (default)
  525. --system-bzip2 use system-installed bzip2 library
  526. --no-system-bzip2 use cmake-provided bzip2 library (default)
  527. --system-liblzma use system-installed liblzma library
  528. --no-system-liblzma use cmake-provided liblzma library (default)
  529. --system-libarchive use system-installed libarchive library
  530. --no-system-libarchive use cmake-provided libarchive library (default)
  531. --system-librhash use system-installed librhash library
  532. --no-system-librhash use cmake-provided librhash library (default)
  533. --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
  534. --no-qt-gui do not build the Qt-based GUI (default)
  535. --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
  536. --sphinx-man build man pages with Sphinx
  537. --sphinx-html build html help with Sphinx
  538. --sphinx-qthelp build qch help with Sphinx
  539. --sphinx-build=<sb> use <sb> as the sphinx-build executable
  540. --sphinx-flags=<flags> pass <flags> to sphinx-build executable
  541. Directory and file names:
  542. --prefix=PREFIX install files in tree rooted at PREFIX
  543. ['"${cmake_default_prefix}"']
  544. --bindir=DIR install binaries in PREFIX/DIR
  545. ['"${cmake_bin_dir_default}"']
  546. --datadir=DIR install data files in PREFIX/DIR
  547. ['"${cmake_data_dir_default}"']
  548. --docdir=DIR install documentation files in PREFIX/DIR
  549. ['"${cmake_doc_dir_default}"']
  550. --mandir=DIR install man pages files in PREFIX/DIR/manN
  551. ['"${cmake_man_dir_default}"']
  552. --xdgdatadir=DIR install XDG specific files in PREFIX/DIR
  553. ['"${cmake_xdgdata_dir_default}"']
  554. '
  555. exit 10
  556. }
  557. # Display CMake bootstrap usage
  558. cmake_version_display()
  559. {
  560. echo "CMake ${cmake_version}, ${cmake_copyright}"
  561. }
  562. # Display CMake bootstrap error, display the log file and exit
  563. cmake_error()
  564. {
  565. res=$1
  566. shift 1
  567. echo "---------------------------------------------"
  568. echo "Error when bootstrapping CMake:"
  569. echo "$*"
  570. echo "---------------------------------------------"
  571. if [ -f cmake_bootstrap.log ]; then
  572. echo "Log of errors: `pwd`/cmake_bootstrap.log"
  573. #cat cmake_bootstrap.log
  574. echo "---------------------------------------------"
  575. fi
  576. exit ${res}
  577. }
  578. cmake_generate_file ()
  579. {
  580. OUTFILE="$1"
  581. CONTENT="$2"
  582. echo "$CONTENT" > "$OUTFILE.tmp"
  583. if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then
  584. rm -f "$OUTFILE.tmp"
  585. else
  586. mv -f "$OUTFILE.tmp" "$OUTFILE"
  587. fi
  588. }
  589. # Replace KWSYS_NAMESPACE with cmsys
  590. cmake_replace_string ()
  591. {
  592. INFILE="$1"
  593. OUTFILE="$2"
  594. SEARCHFOR="$3"
  595. REPLACEWITH="$4"
  596. if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
  597. sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}"
  598. if [ -f "${OUTFILE}${_tmp}" ]; then
  599. if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
  600. #echo "Files are the same"
  601. rm -f "${OUTFILE}${_tmp}"
  602. else
  603. mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
  604. fi
  605. fi
  606. else
  607. cmake_error 1 "Cannot find file ${INFILE}"
  608. fi
  609. }
  610. cmake_kwsys_config_replace_string ()
  611. {
  612. INFILE="$1"
  613. OUTFILE="$2"
  614. shift 2
  615. APPEND="$*"
  616. if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
  617. echo "${APPEND}" > "${OUTFILE}${_tmp}"
  618. sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
  619. s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
  620. s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
  621. s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
  622. s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
  623. s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g;
  624. s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g;
  625. }" "${INFILE}" >> "${OUTFILE}${_tmp}"
  626. if [ -f "${OUTFILE}${_tmp}" ]; then
  627. if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
  628. #echo "Files are the same"
  629. rm -f "${OUTFILE}${_tmp}"
  630. else
  631. mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
  632. fi
  633. fi
  634. else
  635. cmake_error 2 "Cannot find file ${INFILE}"
  636. fi
  637. }
  638. # Write string into a file
  639. cmake_report ()
  640. {
  641. FILE=$1
  642. shift
  643. echo "$*" >> ${FILE}
  644. }
  645. # Escape spaces in strings
  646. cmake_escape ()
  647. {
  648. echo $1 | sed "s/ /\\\\ /g"
  649. }
  650. # Encode object file names.
  651. cmake_obj ()
  652. {
  653. echo $1 | sed 's/\//-/g' | sed 's/$/\.o/'
  654. }
  655. # Strip prefix from argument
  656. cmake_arg ()
  657. {
  658. echo "$1" | sed "s/^${2-[^=]*=}//"
  659. }
  660. # Write message to the log
  661. cmake_log ()
  662. {
  663. echo "$*" >> cmake_bootstrap.log
  664. }
  665. # Return temp file
  666. cmake_tmp_file ()
  667. {
  668. echo "cmake_bootstrap_$$_test"
  669. }
  670. # Run a compiler test. First argument is compiler, second one are compiler
  671. # flags, third one is test source file to be compiled
  672. cmake_try_run ()
  673. {
  674. COMPILER=$1
  675. FLAGS=$2
  676. TESTFILE=$3
  677. if [ ! -f "${TESTFILE}" ]; then
  678. echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
  679. exit 4
  680. fi
  681. TMPFILE=`cmake_tmp_file`
  682. echo "Try: ${COMPILER}"
  683. echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
  684. echo "---------- file -----------------------"
  685. cat "${TESTFILE}"
  686. echo "------------------------------------------"
  687. "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
  688. RES=$?
  689. if [ "${RES}" -ne "0" ]; then
  690. echo "Test failed to compile"
  691. return 1
  692. fi
  693. if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
  694. echo "Test failed to produce executable"
  695. return 2
  696. fi
  697. ./${TMPFILE}
  698. RES=$?
  699. rm -f "${TMPFILE}"
  700. if [ "${RES}" -ne "0" ]; then
  701. echo "Test produced non-zero return code"
  702. return 3
  703. fi
  704. echo "Test succeeded"
  705. return 0
  706. }
  707. # Run a make test. First argument is the make interpreter.
  708. cmake_try_make ()
  709. {
  710. MAKE_PROC="$1"
  711. MAKE_FLAGS="$2"
  712. echo "Try: ${MAKE_PROC}"
  713. "${MAKE_PROC}" ${MAKE_FLAGS}
  714. RES=$?
  715. if [ "${RES}" -ne "0" ]; then
  716. echo "${MAKE_PROC} does not work"
  717. return 1
  718. fi
  719. if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
  720. echo "${COMPILER} does not produce output"
  721. return 2
  722. fi
  723. ./test
  724. RES=$?
  725. rm -f "test"
  726. if [ "${RES}" -ne "0" ]; then
  727. echo "${MAKE_PROC} produces strange executable"
  728. return 3
  729. fi
  730. echo "${MAKE_PROC} works"
  731. return 0
  732. }
  733. # Parse arguments
  734. cmake_verbose=
  735. cmake_parallel_make=
  736. cmake_ccache_enabled=
  737. cmake_prefix_dir="${cmake_default_prefix}"
  738. while test $# != 0; do
  739. case "$1" in
  740. --prefix=*) dir=`cmake_arg "$1"`
  741. cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
  742. --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
  743. --bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;;
  744. --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
  745. --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
  746. --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
  747. --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;;
  748. --init=*) cmake_init_file=`cmake_arg "$1"` ;;
  749. --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
  750. --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
  751. --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma)
  752. lib=`cmake_arg "$1" "--system-"`
  753. cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
  754. --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-librhash|--no-system-zlib|--no-system-liblzma)
  755. lib=`cmake_arg "$1" "--no-system-"`
  756. cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
  757. --qt-gui) cmake_bootstrap_qt_gui="1" ;;
  758. --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
  759. --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
  760. --sphinx-man) cmake_sphinx_man="1" ;;
  761. --sphinx-html) cmake_sphinx_html="1" ;;
  762. --sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
  763. --sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
  764. --sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
  765. --help) cmake_usage ;;
  766. --version) cmake_version_display ; exit 2 ;;
  767. --verbose) cmake_verbose=TRUE ;;
  768. --enable-ccache) cmake_ccache_enabled=TRUE ;;
  769. --) shift; break ;;
  770. *) die "Unknown option: $1" ;;
  771. esac
  772. shift
  773. done
  774. # If verbose, display some information about bootstrap
  775. if [ -n "${cmake_verbose}" ]; then
  776. echo "---------------------------------------------"
  777. echo "Source directory: ${cmake_source_dir}"
  778. echo "Binary directory: ${cmake_binary_dir}"
  779. echo "Prefix directory: ${cmake_prefix_dir}"
  780. echo "System: ${cmake_system}"
  781. if [ "x${cmake_parallel_make}" != "x" ]; then
  782. echo "Doing parallel make: ${cmake_parallel_make}"
  783. fi
  784. echo ""
  785. fi
  786. echo "---------------------------------------------"
  787. # Get CMake version
  788. echo "`cmake_version_display`"
  789. # Check for in-source build
  790. cmake_in_source_build=
  791. if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
  792. -f "${cmake_binary_dir}/Source/cmake.h" ]; then
  793. if [ -n "${cmake_verbose}" ]; then
  794. echo "Warning: This is an in-source build"
  795. fi
  796. cmake_in_source_build=TRUE
  797. fi
  798. # If this is not an in-source build, then Bootstrap stuff should not exist.
  799. if [ -z "${cmake_in_source_build}" ]; then
  800. # Did somebody bootstrap in the source tree?
  801. if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
  802. cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
  803. Looks like somebody did bootstrap CMake in the source tree, but now you are
  804. trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
  805. directory from the source tree."
  806. fi
  807. # Is there a cache in the source tree?
  808. for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
  809. if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
  810. cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
  811. Looks like somebody tried to build CMake in the source tree, but now you are
  812. trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
  813. from the source tree."
  814. fi
  815. done
  816. fi
  817. # Make bootstrap directory
  818. [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
  819. if [ ! -d "${cmake_bootstrap_dir}" ]; then
  820. cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
  821. fi
  822. 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"
  826. fi
  827. # Delete all the bootstrap files
  828. rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
  829. rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
  830. rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
  831. # If building in-source, remove any cmConfigure.h that may
  832. # have been created by a previous run of the bootstrap cmake.
  833. if [ -n "${cmake_in_source_build}" ]; then
  834. rm -f "${cmake_source_dir}/Source/cmConfigure.h"
  835. fi
  836. # If exist compiler flags, set them
  837. cmake_c_flags=${CFLAGS}
  838. cmake_cxx_flags=${CXXFLAGS}
  839. cmake_ld_flags=${LDFLAGS}
  840. # Add Cygwin-specific flags
  841. if ${cmake_system_cygwin}; then
  842. cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
  843. fi
  844. # Add CoreFoundation framework on Darwin
  845. if ${cmake_system_darwin}; then
  846. cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
  847. fi
  848. # Add BeOS toolkits...
  849. if ${cmake_system_beos}; then
  850. cmake_ld_flags="${LDFLAGS} -lroot -lbe"
  851. fi
  852. # Add Haiku toolkits...
  853. if ${cmake_system_haiku}; then
  854. cmake_ld_flags="${LDFLAGS} -lroot -lbe"
  855. fi
  856. #-----------------------------------------------------------------------------
  857. # Detect known toolchains on some platforms.
  858. cmake_toolchains=''
  859. case "${cmake_system}" in
  860. *AIX*) cmake_toolchains='XL GNU' ;;
  861. *CYGWIN*) cmake_toolchains='GNU' ;;
  862. *Darwin*) cmake_toolchains='Clang GNU' ;;
  863. *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
  864. *MINGW*) cmake_toolchains='GNU' ;;
  865. esac
  866. # Toolchain compiler name table.
  867. cmake_toolchain_Clang_CC='clang'
  868. cmake_toolchain_Clang_CXX='clang++'
  869. cmake_toolchain_GNU_CC='gcc'
  870. cmake_toolchain_GNU_CXX='g++'
  871. cmake_toolchain_PGI_CC='pgcc'
  872. cmake_toolchain_PGI_CXX='pgCC'
  873. cmake_toolchain_PathScale_CC='pathcc'
  874. cmake_toolchain_PathScale_CXX='pathCC'
  875. cmake_toolchain_XL_CC='xlc'
  876. cmake_toolchain_XL_CXX='xlC'
  877. cmake_toolchain_try()
  878. {
  879. tc="$1"
  880. TMPFILE=`cmake_tmp_file`
  881. eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
  882. echo 'int main() { return 0; }' > "${TMPFILE}.c"
  883. cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
  884. tc_result_CC="$?"
  885. rm -f "${TMPFILE}.c"
  886. test "${tc_result_CC}" = "0" || return 1
  887. eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
  888. echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
  889. cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
  890. tc_result_CXX="$?"
  891. rm -f "${TMPFILE}.cpp"
  892. test "${tc_result_CXX}" = "0" || return 1
  893. cmake_toolchain="$tc"
  894. }
  895. cmake_toolchain_detect()
  896. {
  897. cmake_toolchain=
  898. for tc in ${cmake_toolchains}; do
  899. echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
  900. cmake_toolchain_try "$tc" &&
  901. echo "Found $tc toolchain" &&
  902. break
  903. done
  904. }
  905. if [ -z "${CC}" -a -z "${CXX}" ]; then
  906. cmake_toolchain_detect
  907. fi
  908. #-----------------------------------------------------------------------------
  909. # Test C compiler
  910. cmake_c_compiler=
  911. # If CC is set, use that for compiler, otherwise use list of known compilers
  912. if [ -n "${cmake_toolchain}" ]; then
  913. eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
  914. elif [ -n "${CC}" ]; then
  915. cmake_c_compilers="${CC}"
  916. else
  917. cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
  918. fi
  919. # Check if C compiler works
  920. TMPFILE=`cmake_tmp_file`
  921. echo '
  922. #ifdef __cplusplus
  923. # error "The CMAKE_C_COMPILER is set to a C++ compiler"
  924. #endif
  925. #if defined(__sun) && __STDC_VERSION__ < 199901L
  926. #error "On Solaris we need C99."
  927. #endif
  928. #include <stdio.h>
  929. int main(int argc, char* argv[])
  930. {
  931. printf("%d%c", (argv != 0), (char)0x0a);
  932. return argc - 1;
  933. }
  934. ' > "${TMPFILE}.c"
  935. for std in 11 99 90; do
  936. try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
  937. for compiler in ${cmake_c_compilers}; do
  938. for flag in '' $try_flags; do
  939. echo "Checking whether '${compiler} ${cmake_c_flags} ${flag}' works." >> cmake_bootstrap.log 2>&1
  940. if cmake_try_run "${compiler}" "${cmake_c_flags} ${flag}" \
  941. "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  942. cmake_c_compiler="${compiler}"
  943. cmake_c_flags="${cmake_c_flags} ${flag}"
  944. break 3
  945. fi
  946. done
  947. done
  948. done
  949. rm -f "${TMPFILE}.c"
  950. if [ -z "${cmake_c_compiler}" ]; then
  951. cmake_error 6 "Cannot find appropriate C compiler on this system.
  952. Please specify one using environment variable CC.
  953. See cmake_bootstrap.log for compilers attempted.
  954. "
  955. fi
  956. echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
  957. #-----------------------------------------------------------------------------
  958. # Test CXX compiler
  959. cmake_cxx_compiler=
  960. # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
  961. # If CC is set, use that for compiler, otherwise use list of known compilers
  962. if [ -n "${cmake_toolchain}" ]; then
  963. eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
  964. elif [ -n "${CXX}" ]; then
  965. cmake_cxx_compilers="${CXX}"
  966. else
  967. cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
  968. fi
  969. # Check if C++ compiler works
  970. TMPFILE=`cmake_tmp_file`
  971. echo '
  972. #include <iostream>
  973. #include <memory>
  974. #if __cplusplus < 201103L
  975. #error "Compiler is not in a mode aware of C++11."
  976. #endif
  977. #if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
  978. #error "SunPro <= 5.13 mode not supported due to bug in move semantics."
  979. #endif
  980. class Class
  981. {
  982. public:
  983. int Get() const { return this->Member; }
  984. private:
  985. int Member = 1;
  986. };
  987. int main()
  988. {
  989. auto const c = std::unique_ptr<Class>(new Class);
  990. std::cout << c->Get() << std::endl;
  991. return 0;
  992. }
  993. ' > "${TMPFILE}.cxx"
  994. for std in 17 14 11; do
  995. try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
  996. for compiler in ${cmake_cxx_compilers}; do
  997. for flag in '' $try_flags; do
  998. echo "Checking whether '${compiler} ${cmake_cxx_flags} ${flag}' works." >> cmake_bootstrap.log 2>&1
  999. if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${flag}" \
  1000. "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  1001. cmake_cxx_compiler="${compiler}"
  1002. cmake_cxx_flags="${cmake_cxx_flags} ${flag} "
  1003. break 3
  1004. fi
  1005. done
  1006. done
  1007. done
  1008. rm -f "${TMPFILE}.cxx"
  1009. if [ -z "${cmake_cxx_compiler}" ]; then
  1010. cmake_error 7 "Cannot find a C++ compiler supporting C++11 on this system.
  1011. Please specify one using environment variable CXX.
  1012. See cmake_bootstrap.log for compilers attempted."
  1013. fi
  1014. echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
  1015. #-----------------------------------------------------------------------------
  1016. # Test Make
  1017. cmake_make_processor=
  1018. cmake_make_flags=
  1019. # If MAKE is set, use that for make processor, otherwise use list of known make
  1020. if [ -n "${MAKE}" ]; then
  1021. cmake_make_processors="${MAKE}"
  1022. else
  1023. cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
  1024. fi
  1025. TMPFILE="`cmake_tmp_file`_dir"
  1026. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  1027. mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
  1028. cd "${cmake_bootstrap_dir}/${TMPFILE}"
  1029. echo '
  1030. test: test.c
  1031. "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
  1032. '>"Makefile"
  1033. echo '
  1034. #include <stdio.h>
  1035. int main(){ printf("1%c", (char)0x0a); return 0; }
  1036. ' > "test.c"
  1037. cmake_original_make_flags="${cmake_make_flags}"
  1038. if [ "x${cmake_parallel_make}" != "x" ]; then
  1039. cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
  1040. fi
  1041. for a in ${cmake_make_processors}; do
  1042. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
  1043. cmake_make_processor="${a}"
  1044. fi
  1045. done
  1046. cmake_full_make_flags="${cmake_make_flags}"
  1047. if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
  1048. if [ -z "${cmake_make_processor}" ]; then
  1049. cmake_make_flags="${cmake_original_make_flags}"
  1050. for a in ${cmake_make_processors}; do
  1051. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
  1052. cmake_make_processor="${a}"
  1053. fi
  1054. done
  1055. fi
  1056. fi
  1057. cd "${cmake_bootstrap_dir}"
  1058. if [ -z "${cmake_make_processor}" ]; then
  1059. cmake_error 8 "Cannot find appropriate Makefile processor on this system.
  1060. Please specify one using environment variable MAKE."
  1061. fi
  1062. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  1063. echo "Makefile processor on this system is: ${cmake_make_processor}"
  1064. if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
  1065. echo "---------------------------------------------"
  1066. echo "Makefile processor ${cmake_make_processor} does not support parallel build"
  1067. echo "---------------------------------------------"
  1068. fi
  1069. # Test for kwsys features
  1070. KWSYS_NAME_IS_KWSYS=0
  1071. KWSYS_BUILD_SHARED=0
  1072. KWSYS_LFS_AVAILABLE=0
  1073. KWSYS_LFS_REQUESTED=0
  1074. KWSYS_STL_HAS_WSTRING=0
  1075. KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=0
  1076. KWSYS_CXX_HAS_SETENV=0
  1077. KWSYS_CXX_HAS_UNSETENV=0
  1078. KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
  1079. KWSYS_CXX_HAS_UTIMENSAT=0
  1080. KWSYS_CXX_HAS_UTIMES=0
  1081. if cmake_try_run "${cmake_cxx_compiler}" \
  1082. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
  1083. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1084. KWSYS_CXX_HAS_SETENV=1
  1085. echo "${cmake_cxx_compiler} has setenv"
  1086. else
  1087. echo "${cmake_cxx_compiler} does not have setenv"
  1088. fi
  1089. if cmake_try_run "${cmake_cxx_compiler}" \
  1090. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
  1091. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1092. KWSYS_CXX_HAS_UNSETENV=1
  1093. echo "${cmake_cxx_compiler} has unsetenv"
  1094. else
  1095. echo "${cmake_cxx_compiler} does not have unsetenv"
  1096. fi
  1097. if cmake_try_run "${cmake_cxx_compiler}" \
  1098. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
  1099. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1100. KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
  1101. echo "${cmake_cxx_compiler} has environ in stdlib.h"
  1102. else
  1103. echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
  1104. fi
  1105. if cmake_try_run "${cmake_cxx_compiler}" \
  1106. "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_WSTRING" \
  1107. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1108. KWSYS_STL_HAS_WSTRING=1
  1109. echo "${cmake_cxx_compiler} has stl wstring"
  1110. else
  1111. echo "${cmake_cxx_compiler} does not have stl wstring"
  1112. fi
  1113. if cmake_try_run "${cmake_cxx_compiler}" \
  1114. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H" \
  1115. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1116. KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=1
  1117. echo "${cmake_cxx_compiler} has <ext/stdio_filebuf.h>"
  1118. else
  1119. echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>"
  1120. fi
  1121. # Just to be safe, let us store compiler and flags to the header file
  1122. cmake_bootstrap_version='$Revision$'
  1123. cmake_compiler_settings_comment="/*
  1124. * Generated by ${cmake_source_dir}/bootstrap
  1125. * Version: ${cmake_bootstrap_version}
  1126. *
  1127. * Source directory: ${cmake_source_dir}
  1128. * Binary directory: ${cmake_bootstrap_dir}
  1129. *
  1130. * C compiler: ${cmake_c_compiler}
  1131. * C flags: ${cmake_c_flags}
  1132. *
  1133. * C++ compiler: ${cmake_cxx_compiler}
  1134. * C++ flags: ${cmake_cxx_flags}
  1135. *
  1136. * Make: ${cmake_make_processor}
  1137. *
  1138. * Sources:
  1139. * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
  1140. * LexerParser Sources:
  1141. * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES}
  1142. * kwSys Sources:
  1143. * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
  1144. * libuv Sources:
  1145. * ${LIBUV_C_SOURCES}
  1146. */
  1147. "
  1148. cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
  1149. # When bootstrapping on MinGW with MSYS we must convert the source
  1150. # directory to a windows path.
  1151. if ${cmake_system_mingw}; then
  1152. CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W`
  1153. CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W`
  1154. else
  1155. CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}"
  1156. CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}"
  1157. fi
  1158. # Write CMake version
  1159. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
  1160. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
  1161. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
  1162. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
  1163. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\""
  1164. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\""
  1165. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
  1166. cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
  1167. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
  1168. cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
  1169. cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)"
  1170. # Regenerate configured headers
  1171. for h in Configure VersionConfig; do
  1172. if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
  1173. rm -f cm${h}.h${_tmp}
  1174. else
  1175. mv -f cm${h}.h${_tmp} cm${h}.h
  1176. fi
  1177. done
  1178. # Prepare KWSYS
  1179. cmake_kwsys_config_replace_string \
  1180. "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
  1181. "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
  1182. "${cmake_compiler_settings_comment}"
  1183. cmake_kwsys_config_replace_string \
  1184. "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
  1185. "${cmake_bootstrap_dir}/cmsys/Configure.h" \
  1186. "${cmake_compiler_settings_comment}"
  1187. for a in ${KWSYS_FILES}; do
  1188. cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
  1189. "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
  1190. done
  1191. cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" ""
  1192. # Generate Makefile
  1193. dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
  1194. objs=""
  1195. for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
  1196. objs="${objs} ${a}.o"
  1197. done
  1198. for a in ${LIBUV_C_SOURCES}; do
  1199. objs="${objs} uv-`cmake_obj ${a}`"
  1200. done
  1201. libs=""
  1202. uv_c_flags=""
  1203. if ${cmake_system_mingw}; then
  1204. uv_c_flags="${uv_c_flags} -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600"
  1205. libs="${libs} -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv"
  1206. else
  1207. uv_c_flags="${uv_c_flags} -DCMAKE_BOOTSTRAP"
  1208. case "${cmake_system}" in
  1209. *AIX*)
  1210. uv_c_flags="${uv_c_flags} -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT -D_THREAD_SAFE"
  1211. libs="${libs} -lperfstat"
  1212. ;;
  1213. *Darwin*)
  1214. uv_c_flags="${uv_c_flags} -D_DARWIN_USE_64_BIT_INODE=1 -D_DARWIN_UNLIMITED_SELECT=1"
  1215. ;;
  1216. *Linux*)
  1217. uv_c_flags="${uv_c_flags} -D_GNU_SOURCE"
  1218. libs="${libs} -ldl -lrt"
  1219. ;;
  1220. *BSD*)
  1221. libs="${libs} -lkvm"
  1222. ;;
  1223. *SunOS*)
  1224. # Normally libuv uses '-D_XOPEN_SOURCE=500 -std=c90' on Solaris 5.10,
  1225. # but we do not need to do that because we bootstrap using POSIX APIs.
  1226. uv_c_flags="${uv_c_flags} -D__EXTENSIONS__ -D_XOPEN_SOURCE=600"
  1227. libs="${libs} -lkstat -lnsl -lsendfile -lsocket -lrt"
  1228. ;;
  1229. esac
  1230. fi
  1231. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/include"`"
  1232. if ${cmake_system_mingw}; then
  1233. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src/win"`"
  1234. else
  1235. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src/unix"`"
  1236. fi
  1237. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src"`"
  1238. if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
  1239. cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
  1240. fi
  1241. if [ "x${cmake_c_flags}" != "x" ]; then
  1242. cmake_c_flags="${cmake_c_flags} "
  1243. fi
  1244. if [ "x${cmake_cxx_flags}" != "x" ]; then
  1245. cmake_cxx_flags="${cmake_cxx_flags} "
  1246. fi
  1247. cmake_c_flags_String="-DKWSYS_STRING_C"
  1248. if ${cmake_system_mingw}; then
  1249. cmake_c_flags_EncodingC="-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_ACP"
  1250. cmake_cxx_flags_EncodingCXX="${cmake_c_flags_EncodingC}"
  1251. cmake_cxx_flags_cmProcessOutput="${cmake_c_flags_EncodingC}"
  1252. fi
  1253. cmake_cxx_flags_SystemTools="
  1254. -DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
  1255. -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
  1256. -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
  1257. -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
  1258. -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
  1259. "
  1260. cmake_c_flags="${cmake_c_flags} \
  1261. -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
  1262. -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  1263. -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
  1264. -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
  1265. cmake_cxx_flags="${cmake_cxx_flags} \
  1266. -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
  1267. -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  1268. -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
  1269. -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
  1270. echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
  1271. echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} ${libs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
  1272. for a in ${CMAKE_CXX_SOURCES}; do
  1273. src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
  1274. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1275. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1276. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1277. done
  1278. for a in ${CMAKE_C_SOURCES}; do
  1279. src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
  1280. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1281. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1282. done
  1283. for a in ${LexerParser_CXX_SOURCES}; do
  1284. src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.cxx"`
  1285. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1286. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1287. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1288. done
  1289. for a in ${LexerParser_C_SOURCES}; do
  1290. src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.c"`
  1291. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1292. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1293. done
  1294. for a in ${KWSYS_C_SOURCES}; do
  1295. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
  1296. src_flags=`eval echo \\${cmake_c_flags_\${a}}`
  1297. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1298. echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1299. done
  1300. for a in ${KWSYS_CXX_SOURCES}; do
  1301. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
  1302. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1303. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1304. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1305. done
  1306. for a in ${LIBUV_C_SOURCES}; do
  1307. src=`cmake_escape "${cmake_source_dir}/Utilities/cmlibuv/${a}"`
  1308. echo "uv-`cmake_obj ${a}` : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1309. echo " ${cmake_c_compiler} ${cmake_c_flags} ${uv_c_flags} -c ${src} -o uv-`cmake_obj ${a}`" >> "${cmake_bootstrap_dir}/Makefile"
  1310. done
  1311. echo '
  1312. rebuild_cache:
  1313. cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
  1314. ' >> "${cmake_bootstrap_dir}/Makefile"
  1315. # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
  1316. echo '
  1317. # Generated by '"${cmake_source_dir}"'/bootstrap
  1318. # Default cmake settings. These may be overridden any settings below.
  1319. set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
  1320. set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
  1321. set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
  1322. set (CMAKE_BIN_DIR "'"${cmake_bin_dir}"'" CACHE PATH "Install location for binaries (relative to prefix)." FORCE)
  1323. set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
  1324. set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE)
  1325. ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1326. # Add configuration settings given as command-line options.
  1327. if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
  1328. echo '
  1329. set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
  1330. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1331. fi
  1332. if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
  1333. echo '
  1334. set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
  1335. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1336. fi
  1337. if [ "x${cmake_sphinx_man}" != "x" ]; then
  1338. echo '
  1339. set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE)
  1340. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1341. fi
  1342. if [ "x${cmake_sphinx_html}" != "x" ]; then
  1343. echo '
  1344. set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE)
  1345. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1346. fi
  1347. if [ "x${cmake_sphinx_qthelp}" != "x" ]; then
  1348. echo '
  1349. set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
  1350. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1351. fi
  1352. if [ "x${cmake_sphinx_build}" != "x" ]; then
  1353. echo '
  1354. set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
  1355. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1356. fi
  1357. if [ "x${cmake_sphinx_flags}" != "x" ]; then
  1358. echo '
  1359. set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
  1360. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1361. fi
  1362. # Add user-specified settings. Handle relative-path case for
  1363. # specification of cmake_init_file.
  1364. (
  1365. cd "${cmake_binary_dir}"
  1366. if [ -f "${cmake_init_file}" ]; then
  1367. cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1368. fi
  1369. )
  1370. echo "---------------------------------------------"
  1371. # Run make to build bootstrap cmake
  1372. if [ "x${cmake_parallel_make}" != "x" ]; then
  1373. ${cmake_make_processor} ${cmake_make_flags}
  1374. else
  1375. ${cmake_make_processor}
  1376. fi
  1377. RES=$?
  1378. if [ "${RES}" -ne "0" ]; then
  1379. cmake_error 9 "Problem while running ${cmake_make_processor}"
  1380. fi
  1381. cd "${cmake_binary_dir}"
  1382. # Set C, CXX, and MAKE environment variables, so that real real cmake will be
  1383. # build with same compiler and make
  1384. CC="${cmake_c_compiler}"
  1385. CXX="${cmake_cxx_compiler}"
  1386. if [ -n "${cmake_ccache_enabled}" ]; then
  1387. CC="ccache ${CC}"
  1388. CXX="ccache ${CXX}"
  1389. fi
  1390. MAKE="${cmake_make_processor}"
  1391. export CC
  1392. export CXX
  1393. export MAKE
  1394. # Run bootstrap CMake to configure real CMake
  1395. cmake_options="-DCMAKE_BOOTSTRAP=1"
  1396. if [ -n "${cmake_verbose}" ]; then
  1397. cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
  1398. fi
  1399. "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
  1400. RES=$?
  1401. if [ "${RES}" -ne "0" ]; then
  1402. cmake_error 11 "Problem while running initial CMake"
  1403. fi
  1404. echo "---------------------------------------------"
  1405. # And we are done. Now just run make
  1406. echo "CMake has bootstrapped. Now run ${cmake_make_processor}."