1
0

bootstrap 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553
  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 clang xlc icc tcc"
  201. CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ clang++ 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. cmUVHandlePtr \
  392. cmVersion \
  393. cmWhileCommand \
  394. cmWorkingDirectory \
  395. cmake \
  396. cmakemain \
  397. cmcmd \
  398. "
  399. if ${cmake_system_mingw}; then
  400. CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
  401. cmGlobalMSYSMakefileGenerator \
  402. cmGlobalMinGWMakefileGenerator"
  403. fi
  404. LexerParser_CXX_SOURCES="\
  405. cmCommandArgumentLexer \
  406. cmCommandArgumentParser \
  407. cmExprLexer \
  408. cmExprParser \
  409. "
  410. LexerParser_C_SOURCES="\
  411. cmListFileLexer \
  412. "
  413. if ${cmake_system_mingw}; then
  414. KWSYS_C_SOURCES="\
  415. EncodingC \
  416. ProcessWin32 \
  417. String \
  418. System \
  419. Terminal"
  420. else
  421. KWSYS_C_SOURCES="\
  422. EncodingC \
  423. ProcessUNIX \
  424. String \
  425. System \
  426. Terminal"
  427. fi
  428. KWSYS_CXX_SOURCES="\
  429. Directory \
  430. EncodingCXX \
  431. FStream \
  432. Glob \
  433. RegularExpression \
  434. SystemTools"
  435. KWSYS_FILES="\
  436. Directory.hxx \
  437. Encoding.h \
  438. Encoding.hxx \
  439. FStream.hxx \
  440. Glob.hxx \
  441. Process.h \
  442. RegularExpression.hxx \
  443. String.h \
  444. String.hxx \
  445. System.h \
  446. SystemTools.hxx \
  447. Terminal.h"
  448. if ${cmake_system_mingw}; then
  449. LIBUV_C_SOURCES="\
  450. src/fs-poll.c \
  451. src/inet.c \
  452. src/threadpool.c \
  453. src/uv-common.c \
  454. src/win/async.c \
  455. src/win/core.c \
  456. src/win/detect-wakeup.c \
  457. src/win/dl.c \
  458. src/win/error.c \
  459. src/win/fs-event.c \
  460. src/win/fs.c \
  461. src/win/getaddrinfo.c \
  462. src/win/getnameinfo.c \
  463. src/win/handle.c \
  464. src/win/loop-watcher.c \
  465. src/win/pipe.c \
  466. src/win/poll.c \
  467. src/win/process-stdio.c \
  468. src/win/process.c \
  469. src/win/req.c \
  470. src/win/signal.c \
  471. src/win/stream.c \
  472. src/win/tcp.c \
  473. src/win/thread.c \
  474. src/win/timer.c \
  475. src/win/tty.c \
  476. src/win/udp.c \
  477. src/win/util.c \
  478. src/win/winapi.c \
  479. src/win/winsock.c \
  480. "
  481. else
  482. LIBUV_C_SOURCES="\
  483. src/uv-common.c \
  484. src/unix/cmake-bootstrap.c \
  485. src/unix/core.c \
  486. src/unix/fs.c \
  487. src/unix/loop.c \
  488. src/unix/loop-watcher.c \
  489. src/unix/no-fsevents.c \
  490. src/unix/pipe.c \
  491. src/unix/poll.c \
  492. src/unix/posix-hrtime.c \
  493. src/unix/posix-poll.c \
  494. src/unix/process.c \
  495. src/unix/signal.c \
  496. src/unix/stream.c \
  497. src/unix/timer.c \
  498. "
  499. fi
  500. # Display CMake bootstrap usage
  501. cmake_usage()
  502. {
  503. echo '
  504. Usage: '"$0"' [<options>...] [-- <cmake-options>...]
  505. Options: [defaults in brackets after descriptions]
  506. Configuration:
  507. --help print this message
  508. --version only print version information
  509. --verbose display more information
  510. --parallel=n bootstrap cmake in parallel, where n is
  511. number of nodes [1]
  512. --enable-ccache Enable ccache when building cmake
  513. --init=FILE load FILE as script to populate cache
  514. --system-libs use all system-installed third-party libraries
  515. (for use only by package maintainers)
  516. --no-system-libs use all cmake-provided third-party libraries
  517. (default)
  518. --system-curl use system-installed curl library
  519. --no-system-curl use cmake-provided curl library (default)
  520. --system-expat use system-installed expat library
  521. --no-system-expat use cmake-provided expat library (default)
  522. --system-jsoncpp use system-installed jsoncpp library
  523. --no-system-jsoncpp use cmake-provided jsoncpp library (default)
  524. --system-zlib use system-installed zlib library
  525. --no-system-zlib use cmake-provided zlib library (default)
  526. --system-bzip2 use system-installed bzip2 library
  527. --no-system-bzip2 use cmake-provided bzip2 library (default)
  528. --system-liblzma use system-installed liblzma library
  529. --no-system-liblzma use cmake-provided liblzma library (default)
  530. --system-libarchive use system-installed libarchive library
  531. --no-system-libarchive use cmake-provided libarchive library (default)
  532. --system-librhash use system-installed librhash library
  533. --no-system-librhash use cmake-provided librhash library (default)
  534. --system-libuv use system-installed libuv library
  535. --no-system-libuv use cmake-provided libuv library (default)
  536. --qt-gui build the Qt-based GUI (requires Qt >= 4.2)
  537. --no-qt-gui do not build the Qt-based GUI (default)
  538. --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
  539. --sphinx-man build man pages with Sphinx
  540. --sphinx-html build html help with Sphinx
  541. --sphinx-qthelp build qch help with Sphinx
  542. --sphinx-build=<sb> use <sb> as the sphinx-build executable
  543. --sphinx-flags=<flags> pass <flags> to sphinx-build executable
  544. Directory and file names:
  545. --prefix=PREFIX install files in tree rooted at PREFIX
  546. ['"${cmake_default_prefix}"']
  547. --bindir=DIR install binaries in PREFIX/DIR
  548. ['"${cmake_bin_dir_default}"']
  549. --datadir=DIR install data files in PREFIX/DIR
  550. ['"${cmake_data_dir_default}"']
  551. --docdir=DIR install documentation files in PREFIX/DIR
  552. ['"${cmake_doc_dir_default}"']
  553. --mandir=DIR install man pages files in PREFIX/DIR/manN
  554. ['"${cmake_man_dir_default}"']
  555. --xdgdatadir=DIR install XDG specific files in PREFIX/DIR
  556. ['"${cmake_xdgdata_dir_default}"']
  557. '
  558. exit 10
  559. }
  560. # Display CMake bootstrap usage
  561. cmake_version_display()
  562. {
  563. echo "CMake ${cmake_version}, ${cmake_copyright}"
  564. }
  565. # Display CMake bootstrap error, display the log file and exit
  566. cmake_error()
  567. {
  568. res=$1
  569. shift 1
  570. echo "---------------------------------------------"
  571. echo "Error when bootstrapping CMake:"
  572. echo "$*"
  573. echo "---------------------------------------------"
  574. if [ -f cmake_bootstrap.log ]; then
  575. echo "Log of errors: `pwd`/cmake_bootstrap.log"
  576. #cat cmake_bootstrap.log
  577. echo "---------------------------------------------"
  578. fi
  579. exit ${res}
  580. }
  581. cmake_generate_file ()
  582. {
  583. OUTFILE="$1"
  584. CONTENT="$2"
  585. echo "$CONTENT" > "$OUTFILE.tmp"
  586. if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then
  587. rm -f "$OUTFILE.tmp"
  588. else
  589. mv -f "$OUTFILE.tmp" "$OUTFILE"
  590. fi
  591. }
  592. # Replace KWSYS_NAMESPACE with cmsys
  593. cmake_replace_string ()
  594. {
  595. INFILE="$1"
  596. OUTFILE="$2"
  597. SEARCHFOR="$3"
  598. REPLACEWITH="$4"
  599. if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
  600. sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}"
  601. if [ -f "${OUTFILE}${_tmp}" ]; then
  602. if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
  603. #echo "Files are the same"
  604. rm -f "${OUTFILE}${_tmp}"
  605. else
  606. mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
  607. fi
  608. fi
  609. else
  610. cmake_error 1 "Cannot find file ${INFILE}"
  611. fi
  612. }
  613. cmake_kwsys_config_replace_string ()
  614. {
  615. INFILE="$1"
  616. OUTFILE="$2"
  617. shift 2
  618. APPEND="$*"
  619. if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then
  620. echo "${APPEND}" > "${OUTFILE}${_tmp}"
  621. sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
  622. s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
  623. s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
  624. s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
  625. s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
  626. s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g;
  627. s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g;
  628. }" "${INFILE}" >> "${OUTFILE}${_tmp}"
  629. if [ -f "${OUTFILE}${_tmp}" ]; then
  630. if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
  631. #echo "Files are the same"
  632. rm -f "${OUTFILE}${_tmp}"
  633. else
  634. mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
  635. fi
  636. fi
  637. else
  638. cmake_error 2 "Cannot find file ${INFILE}"
  639. fi
  640. }
  641. # Write string into a file
  642. cmake_report ()
  643. {
  644. FILE=$1
  645. shift
  646. echo "$*" >> ${FILE}
  647. }
  648. # Escape spaces in strings
  649. cmake_escape ()
  650. {
  651. echo $1 | sed "s/ /\\\\ /g"
  652. }
  653. # Encode object file names.
  654. cmake_obj ()
  655. {
  656. echo $1 | sed 's/\//-/g' | sed 's/$/\.o/'
  657. }
  658. # Strip prefix from argument
  659. cmake_arg ()
  660. {
  661. echo "$1" | sed "s/^${2-[^=]*=}//"
  662. }
  663. # Write message to the log
  664. cmake_log ()
  665. {
  666. echo "$*" >> cmake_bootstrap.log
  667. }
  668. # Return temp file
  669. cmake_tmp_file ()
  670. {
  671. echo "cmake_bootstrap_$$_test"
  672. }
  673. # Run a compiler test. First argument is compiler, second one are compiler
  674. # flags, third one is test source file to be compiled
  675. cmake_try_run ()
  676. {
  677. COMPILER=$1
  678. FLAGS=$2
  679. TESTFILE=$3
  680. if [ ! -f "${TESTFILE}" ]; then
  681. echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
  682. exit 4
  683. fi
  684. TMPFILE=`cmake_tmp_file`
  685. echo "Try: ${COMPILER}"
  686. echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
  687. echo "---------- file -----------------------"
  688. cat "${TESTFILE}"
  689. echo "------------------------------------------"
  690. "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
  691. RES=$?
  692. if [ "${RES}" -ne "0" ]; then
  693. echo "Test failed to compile"
  694. return 1
  695. fi
  696. if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then
  697. echo "Test failed to produce executable"
  698. return 2
  699. fi
  700. ./${TMPFILE}
  701. RES=$?
  702. rm -f "${TMPFILE}"
  703. if [ "${RES}" -ne "0" ]; then
  704. echo "Test produced non-zero return code"
  705. return 3
  706. fi
  707. echo "Test succeeded"
  708. return 0
  709. }
  710. # Run a make test. First argument is the make interpreter.
  711. cmake_try_make ()
  712. {
  713. MAKE_PROC="$1"
  714. MAKE_FLAGS="$2"
  715. echo "Try: ${MAKE_PROC}"
  716. "${MAKE_PROC}" ${MAKE_FLAGS}
  717. RES=$?
  718. if [ "${RES}" -ne "0" ]; then
  719. echo "${MAKE_PROC} does not work"
  720. return 1
  721. fi
  722. if [ ! -f "test" ] && [ ! -f "test.exe" ]; then
  723. echo "${COMPILER} does not produce output"
  724. return 2
  725. fi
  726. ./test
  727. RES=$?
  728. rm -f "test"
  729. if [ "${RES}" -ne "0" ]; then
  730. echo "${MAKE_PROC} produces strange executable"
  731. return 3
  732. fi
  733. echo "${MAKE_PROC} works"
  734. return 0
  735. }
  736. # Parse arguments
  737. cmake_verbose=
  738. cmake_parallel_make=
  739. cmake_ccache_enabled=
  740. cmake_prefix_dir="${cmake_default_prefix}"
  741. while test $# != 0; do
  742. case "$1" in
  743. --prefix=*) dir=`cmake_arg "$1"`
  744. cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
  745. --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
  746. --bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;;
  747. --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
  748. --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
  749. --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
  750. --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;;
  751. --init=*) cmake_init_file=`cmake_arg "$1"` ;;
  752. --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
  753. --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
  754. --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-libuv)
  755. lib=`cmake_arg "$1" "--system-"`
  756. cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
  757. --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-libuv)
  758. lib=`cmake_arg "$1" "--no-system-"`
  759. cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
  760. --qt-gui) cmake_bootstrap_qt_gui="1" ;;
  761. --no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
  762. --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
  763. --sphinx-man) cmake_sphinx_man="1" ;;
  764. --sphinx-html) cmake_sphinx_html="1" ;;
  765. --sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
  766. --sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
  767. --sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
  768. --help) cmake_usage ;;
  769. --version) cmake_version_display ; exit 2 ;;
  770. --verbose) cmake_verbose=TRUE ;;
  771. --enable-ccache) cmake_ccache_enabled=TRUE ;;
  772. --) shift; break ;;
  773. *) die "Unknown option: $1" ;;
  774. esac
  775. shift
  776. done
  777. # If verbose, display some information about bootstrap
  778. if [ -n "${cmake_verbose}" ]; then
  779. echo "---------------------------------------------"
  780. echo "Source directory: ${cmake_source_dir}"
  781. echo "Binary directory: ${cmake_binary_dir}"
  782. echo "Prefix directory: ${cmake_prefix_dir}"
  783. echo "System: ${cmake_system}"
  784. if [ "x${cmake_parallel_make}" != "x" ]; then
  785. echo "Doing parallel make: ${cmake_parallel_make}"
  786. fi
  787. echo ""
  788. fi
  789. echo "---------------------------------------------"
  790. # Get CMake version
  791. echo "`cmake_version_display`"
  792. # Check for in-source build
  793. cmake_in_source_build=
  794. if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \
  795. -f "${cmake_binary_dir}/Source/cmake.h" ]; then
  796. if [ -n "${cmake_verbose}" ]; then
  797. echo "Warning: This is an in-source build"
  798. fi
  799. cmake_in_source_build=TRUE
  800. fi
  801. # If this is not an in-source build, then Bootstrap stuff should not exist.
  802. if [ -z "${cmake_in_source_build}" ]; then
  803. # Did somebody bootstrap in the source tree?
  804. if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then
  805. cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\".
  806. Looks like somebody did bootstrap CMake in the source tree, but now you are
  807. trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk}
  808. directory from the source tree."
  809. fi
  810. # Is there a cache in the source tree?
  811. for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do
  812. if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then
  813. cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\".
  814. Looks like somebody tried to build CMake in the source tree, but now you are
  815. trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\"
  816. from the source tree."
  817. fi
  818. done
  819. fi
  820. # Make bootstrap directory
  821. [ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}"
  822. if [ ! -d "${cmake_bootstrap_dir}" ]; then
  823. cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake."
  824. fi
  825. cd "${cmake_bootstrap_dir}"
  826. [ -d "cmsys" ] || mkdir "cmsys"
  827. if [ ! -d "cmsys" ]; then
  828. cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys"
  829. fi
  830. # Delete all the bootstrap files
  831. rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
  832. rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
  833. rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}"
  834. # If building in-source, remove any cmConfigure.h that may
  835. # have been created by a previous run of the bootstrap cmake.
  836. if [ -n "${cmake_in_source_build}" ]; then
  837. rm -f "${cmake_source_dir}/Source/cmConfigure.h"
  838. fi
  839. # If exist compiler flags, set them
  840. cmake_c_flags=${CFLAGS}
  841. cmake_cxx_flags=${CXXFLAGS}
  842. cmake_ld_flags=${LDFLAGS}
  843. # Add Cygwin-specific flags
  844. if ${cmake_system_cygwin}; then
  845. cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import"
  846. fi
  847. # Add CoreFoundation framework on Darwin
  848. if ${cmake_system_darwin}; then
  849. cmake_ld_flags="${LDFLAGS} -framework CoreFoundation"
  850. fi
  851. # Add BeOS toolkits...
  852. if ${cmake_system_beos}; then
  853. cmake_ld_flags="${LDFLAGS} -lroot -lbe"
  854. fi
  855. # Add Haiku toolkits...
  856. if ${cmake_system_haiku}; then
  857. cmake_ld_flags="${LDFLAGS} -lroot -lbe"
  858. fi
  859. #-----------------------------------------------------------------------------
  860. # Detect known toolchains on some platforms.
  861. cmake_toolchains=''
  862. case "${cmake_system}" in
  863. *AIX*) cmake_toolchains='XL GNU' ;;
  864. *CYGWIN*) cmake_toolchains='GNU' ;;
  865. *Darwin*) cmake_toolchains='Clang GNU' ;;
  866. *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;;
  867. *MINGW*) cmake_toolchains='GNU' ;;
  868. esac
  869. # Toolchain compiler name table.
  870. cmake_toolchain_Clang_CC='clang'
  871. cmake_toolchain_Clang_CXX='clang++'
  872. cmake_toolchain_GNU_CC='gcc'
  873. cmake_toolchain_GNU_CXX='g++'
  874. cmake_toolchain_PGI_CC='pgcc'
  875. cmake_toolchain_PGI_CXX='pgCC'
  876. cmake_toolchain_PathScale_CC='pathcc'
  877. cmake_toolchain_PathScale_CXX='pathCC'
  878. cmake_toolchain_XL_CC='xlc'
  879. cmake_toolchain_XL_CXX='xlC'
  880. cmake_toolchain_try()
  881. {
  882. tc="$1"
  883. TMPFILE=`cmake_tmp_file`
  884. eval "tc_CC=\${cmake_toolchain_${tc}_CC}"
  885. echo 'int main() { return 0; }' > "${TMPFILE}.c"
  886. cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1
  887. tc_result_CC="$?"
  888. rm -f "${TMPFILE}.c"
  889. test "${tc_result_CC}" = "0" || return 1
  890. eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}"
  891. echo 'int main() { return 0; }' > "${TMPFILE}.cpp"
  892. cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1
  893. tc_result_CXX="$?"
  894. rm -f "${TMPFILE}.cpp"
  895. test "${tc_result_CXX}" = "0" || return 1
  896. cmake_toolchain="$tc"
  897. }
  898. cmake_toolchain_detect()
  899. {
  900. cmake_toolchain=
  901. for tc in ${cmake_toolchains}; do
  902. echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1
  903. cmake_toolchain_try "$tc" &&
  904. echo "Found $tc toolchain" &&
  905. break
  906. done
  907. }
  908. if [ -z "${CC}" -a -z "${CXX}" ]; then
  909. cmake_toolchain_detect
  910. fi
  911. thread_flags=''
  912. case "${cmake_system}" in
  913. *AIX*) thread_flags='-pthread' ;;
  914. esac
  915. #-----------------------------------------------------------------------------
  916. # Test C compiler
  917. cmake_c_compiler=
  918. # If CC is set, use that for compiler, otherwise use list of known compilers
  919. if [ -n "${cmake_toolchain}" ]; then
  920. eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
  921. elif [ -n "${CC}" ]; then
  922. cmake_c_compilers="${CC}"
  923. else
  924. cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
  925. fi
  926. # Check if C compiler works
  927. TMPFILE=`cmake_tmp_file`
  928. echo '
  929. #ifdef __cplusplus
  930. # error "The CMAKE_C_COMPILER is set to a C++ compiler"
  931. #endif
  932. #if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
  933. #error "On AIX with GNU we need the -pthread flag."
  934. #endif
  935. #if defined(__sun) && __STDC_VERSION__ < 199901L
  936. #error "On Solaris we need C99."
  937. #endif
  938. #include <stdio.h>
  939. int main(int argc, char* argv[])
  940. {
  941. printf("%d%c", (argv != 0), (char)0x0a);
  942. return argc - 1;
  943. }
  944. ' > "${TMPFILE}.c"
  945. for std in 11 99 90; do
  946. std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
  947. for compiler in ${cmake_c_compilers}; do
  948. for std_flag in '' $std_flags; do
  949. for thread_flag in '' $thread_flags; do
  950. echo "Checking whether '${compiler} ${cmake_c_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
  951. if cmake_try_run "${compiler}" "${cmake_c_flags} ${std_flag} ${thread_flag}" \
  952. "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
  953. cmake_c_compiler="${compiler}"
  954. cmake_c_flags="${cmake_c_flags} ${std_flag} ${thread_flag}"
  955. break 3
  956. fi
  957. done
  958. done
  959. done
  960. done
  961. rm -f "${TMPFILE}.c"
  962. if [ -z "${cmake_c_compiler}" ]; then
  963. cmake_error 6 "Cannot find appropriate C compiler on this system.
  964. Please specify one using environment variable CC.
  965. See cmake_bootstrap.log for compilers attempted.
  966. "
  967. fi
  968. echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}"
  969. #-----------------------------------------------------------------------------
  970. # Test CXX compiler
  971. cmake_cxx_compiler=
  972. # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler.
  973. # If CC is set, use that for compiler, otherwise use list of known compilers
  974. if [ -n "${cmake_toolchain}" ]; then
  975. eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
  976. elif [ -n "${CXX}" ]; then
  977. cmake_cxx_compilers="${CXX}"
  978. else
  979. cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
  980. fi
  981. # Check if C++ compiler works
  982. TMPFILE=`cmake_tmp_file`
  983. echo '
  984. #include <iostream>
  985. #include <memory>
  986. #include <unordered_map>
  987. #if __cplusplus < 201103L
  988. #error "Compiler is not in a mode aware of C++11."
  989. #endif
  990. #if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE)
  991. #error "On AIX with GNU we need the -pthread flag."
  992. #endif
  993. #if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
  994. #error "SunPro <= 5.13 mode not supported due to bug in move semantics."
  995. #endif
  996. class Class
  997. {
  998. public:
  999. int Get() const { return this->Member; }
  1000. private:
  1001. int Member = 1;
  1002. };
  1003. int main()
  1004. {
  1005. auto const c = std::unique_ptr<Class>(new Class);
  1006. std::cout << c->Get() << std::endl;
  1007. return 0;
  1008. }
  1009. ' > "${TMPFILE}.cxx"
  1010. for std in 17 14 11; do
  1011. std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
  1012. for compiler in ${cmake_cxx_compilers}; do
  1013. for std_flag in '' $std_flags; do
  1014. for thread_flag in '' $thread_flags; do
  1015. echo "Checking whether '${compiler} ${cmake_cxx_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
  1016. if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${std_flag} ${thread_flag}" \
  1017. "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
  1018. cmake_cxx_compiler="${compiler}"
  1019. cmake_cxx_flags="${cmake_cxx_flags} ${std_flag} ${thread_flag} "
  1020. break 3
  1021. fi
  1022. done
  1023. done
  1024. done
  1025. done
  1026. rm -f "${TMPFILE}.cxx"
  1027. if [ -z "${cmake_cxx_compiler}" ]; then
  1028. cmake_error 7 "Cannot find a C++ compiler supporting C++11 on this system.
  1029. Please specify one using environment variable CXX.
  1030. See cmake_bootstrap.log for compilers attempted."
  1031. fi
  1032. echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}"
  1033. #-----------------------------------------------------------------------------
  1034. # Test Make
  1035. cmake_make_processor=
  1036. cmake_make_flags=
  1037. # If MAKE is set, use that for make processor, otherwise use list of known make
  1038. if [ -n "${MAKE}" ]; then
  1039. cmake_make_processors="${MAKE}"
  1040. else
  1041. cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}"
  1042. fi
  1043. TMPFILE="`cmake_tmp_file`_dir"
  1044. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  1045. mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
  1046. cd "${cmake_bootstrap_dir}/${TMPFILE}"
  1047. echo '
  1048. test: test.c
  1049. "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
  1050. '>"Makefile"
  1051. echo '
  1052. #include <stdio.h>
  1053. int main(){ printf("1%c", (char)0x0a); return 0; }
  1054. ' > "test.c"
  1055. cmake_original_make_flags="${cmake_make_flags}"
  1056. if [ "x${cmake_parallel_make}" != "x" ]; then
  1057. cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}"
  1058. fi
  1059. for a in ${cmake_make_processors}; do
  1060. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
  1061. cmake_make_processor="${a}"
  1062. fi
  1063. done
  1064. cmake_full_make_flags="${cmake_make_flags}"
  1065. if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then
  1066. if [ -z "${cmake_make_processor}" ]; then
  1067. cmake_make_flags="${cmake_original_make_flags}"
  1068. for a in ${cmake_make_processors}; do
  1069. if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then
  1070. cmake_make_processor="${a}"
  1071. fi
  1072. done
  1073. fi
  1074. fi
  1075. cd "${cmake_bootstrap_dir}"
  1076. if [ -z "${cmake_make_processor}" ]; then
  1077. cmake_error 8 "Cannot find appropriate Makefile processor on this system.
  1078. Please specify one using environment variable MAKE."
  1079. fi
  1080. rm -rf "${cmake_bootstrap_dir}/${TMPFILE}"
  1081. echo "Makefile processor on this system is: ${cmake_make_processor}"
  1082. if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then
  1083. echo "---------------------------------------------"
  1084. echo "Makefile processor ${cmake_make_processor} does not support parallel build"
  1085. echo "---------------------------------------------"
  1086. fi
  1087. # Test for kwsys features
  1088. KWSYS_NAME_IS_KWSYS=0
  1089. KWSYS_BUILD_SHARED=0
  1090. KWSYS_LFS_AVAILABLE=0
  1091. KWSYS_LFS_REQUESTED=0
  1092. KWSYS_STL_HAS_WSTRING=0
  1093. KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=0
  1094. KWSYS_CXX_HAS_SETENV=0
  1095. KWSYS_CXX_HAS_UNSETENV=0
  1096. KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0
  1097. KWSYS_CXX_HAS_UTIMENSAT=0
  1098. KWSYS_CXX_HAS_UTIMES=0
  1099. if cmake_try_run "${cmake_cxx_compiler}" \
  1100. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \
  1101. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1102. KWSYS_CXX_HAS_SETENV=1
  1103. echo "${cmake_cxx_compiler} has setenv"
  1104. else
  1105. echo "${cmake_cxx_compiler} does not have setenv"
  1106. fi
  1107. if cmake_try_run "${cmake_cxx_compiler}" \
  1108. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \
  1109. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1110. KWSYS_CXX_HAS_UNSETENV=1
  1111. echo "${cmake_cxx_compiler} has unsetenv"
  1112. else
  1113. echo "${cmake_cxx_compiler} does not have unsetenv"
  1114. fi
  1115. if cmake_try_run "${cmake_cxx_compiler}" \
  1116. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \
  1117. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1118. KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1
  1119. echo "${cmake_cxx_compiler} has environ in stdlib.h"
  1120. else
  1121. echo "${cmake_cxx_compiler} does not have environ in stdlib.h"
  1122. fi
  1123. if cmake_try_run "${cmake_cxx_compiler}" \
  1124. "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_WSTRING" \
  1125. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1126. KWSYS_STL_HAS_WSTRING=1
  1127. echo "${cmake_cxx_compiler} has stl wstring"
  1128. else
  1129. echo "${cmake_cxx_compiler} does not have stl wstring"
  1130. fi
  1131. if cmake_try_run "${cmake_cxx_compiler}" \
  1132. "${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H" \
  1133. "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
  1134. KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=1
  1135. echo "${cmake_cxx_compiler} has <ext/stdio_filebuf.h>"
  1136. else
  1137. echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>"
  1138. fi
  1139. # Just to be safe, let us store compiler and flags to the header file
  1140. cmake_bootstrap_version='$Revision$'
  1141. cmake_compiler_settings_comment="/*
  1142. * Generated by ${cmake_source_dir}/bootstrap
  1143. * Version: ${cmake_bootstrap_version}
  1144. *
  1145. * Source directory: ${cmake_source_dir}
  1146. * Binary directory: ${cmake_bootstrap_dir}
  1147. *
  1148. * C compiler: ${cmake_c_compiler}
  1149. * C flags: ${cmake_c_flags}
  1150. *
  1151. * C++ compiler: ${cmake_cxx_compiler}
  1152. * C++ flags: ${cmake_cxx_flags}
  1153. *
  1154. * Make: ${cmake_make_processor}
  1155. *
  1156. * Sources:
  1157. * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
  1158. * LexerParser Sources:
  1159. * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES}
  1160. * kwSys Sources:
  1161. * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
  1162. * libuv Sources:
  1163. * ${LIBUV_C_SOURCES}
  1164. */
  1165. "
  1166. cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}"
  1167. # When bootstrapping on MinGW with MSYS we must convert the source
  1168. # directory to a windows path.
  1169. if ${cmake_system_mingw}; then
  1170. CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W`
  1171. CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W`
  1172. else
  1173. CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}"
  1174. CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}"
  1175. fi
  1176. # Write CMake version
  1177. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
  1178. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
  1179. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
  1180. cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
  1181. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\""
  1182. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\""
  1183. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
  1184. cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
  1185. cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
  1186. cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
  1187. cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)"
  1188. # Regenerate configured headers
  1189. for h in Configure VersionConfig; do
  1190. if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then
  1191. rm -f cm${h}.h${_tmp}
  1192. else
  1193. mv -f cm${h}.h${_tmp} cm${h}.h
  1194. fi
  1195. done
  1196. # Prepare KWSYS
  1197. cmake_kwsys_config_replace_string \
  1198. "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \
  1199. "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \
  1200. "${cmake_compiler_settings_comment}"
  1201. cmake_kwsys_config_replace_string \
  1202. "${cmake_source_dir}/Source/kwsys/Configure.h.in" \
  1203. "${cmake_bootstrap_dir}/cmsys/Configure.h" \
  1204. "${cmake_compiler_settings_comment}"
  1205. for a in ${KWSYS_FILES}; do
  1206. cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \
  1207. "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys
  1208. done
  1209. cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" ""
  1210. # Generate Makefile
  1211. dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
  1212. objs=""
  1213. for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
  1214. objs="${objs} ${a}.o"
  1215. done
  1216. for a in ${LIBUV_C_SOURCES}; do
  1217. objs="${objs} uv-`cmake_obj ${a}`"
  1218. done
  1219. libs=""
  1220. uv_c_flags=""
  1221. if ${cmake_system_mingw}; then
  1222. uv_c_flags="${uv_c_flags} -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600"
  1223. libs="${libs} -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv"
  1224. else
  1225. uv_c_flags="${uv_c_flags} -DCMAKE_BOOTSTRAP"
  1226. case "${cmake_system}" in
  1227. *AIX*)
  1228. uv_c_flags="${uv_c_flags} -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT"
  1229. libs="${libs} -lperfstat"
  1230. ;;
  1231. *Darwin*)
  1232. uv_c_flags="${uv_c_flags} -D_DARWIN_USE_64_BIT_INODE=1 -D_DARWIN_UNLIMITED_SELECT=1"
  1233. ;;
  1234. *Linux*)
  1235. uv_c_flags="${uv_c_flags} -D_GNU_SOURCE"
  1236. libs="${libs} -ldl -lrt"
  1237. ;;
  1238. *BSD*)
  1239. libs="${libs} -lkvm"
  1240. ;;
  1241. *SunOS*)
  1242. # Normally libuv uses '-D_XOPEN_SOURCE=500 -std=c90' on Solaris 5.10,
  1243. # but we do not need to do that because we bootstrap using POSIX APIs.
  1244. uv_c_flags="${uv_c_flags} -D__EXTENSIONS__ -D_XOPEN_SOURCE=600"
  1245. libs="${libs} -lkstat -lnsl -lsendfile -lsocket -lrt"
  1246. ;;
  1247. esac
  1248. fi
  1249. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/include"`"
  1250. if ${cmake_system_mingw}; then
  1251. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src/win"`"
  1252. else
  1253. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src/unix"`"
  1254. fi
  1255. uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src"`"
  1256. if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
  1257. cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
  1258. fi
  1259. if [ "x${cmake_c_flags}" != "x" ]; then
  1260. cmake_c_flags="${cmake_c_flags} "
  1261. fi
  1262. if [ "x${cmake_cxx_flags}" != "x" ]; then
  1263. cmake_cxx_flags="${cmake_cxx_flags} "
  1264. fi
  1265. cmake_c_flags_String="-DKWSYS_STRING_C"
  1266. if ${cmake_system_mingw}; then
  1267. cmake_c_flags_EncodingC="-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_ACP"
  1268. cmake_cxx_flags_EncodingCXX="${cmake_c_flags_EncodingC}"
  1269. cmake_cxx_flags_cmProcessOutput="${cmake_c_flags_EncodingC}"
  1270. fi
  1271. cmake_cxx_flags_SystemTools="
  1272. -DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV}
  1273. -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV}
  1274. -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H}
  1275. -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT}
  1276. -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES}
  1277. "
  1278. cmake_c_flags="${cmake_c_flags} \
  1279. -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
  1280. -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  1281. -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
  1282. -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
  1283. cmake_cxx_flags="${cmake_cxx_flags} \
  1284. -I`cmake_escape \"${cmake_bootstrap_dir}\"` \
  1285. -I`cmake_escape \"${cmake_source_dir}/Source\"` \
  1286. -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \
  1287. -I`cmake_escape \"${cmake_source_dir}/Utilities\"`"
  1288. echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile"
  1289. echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} ${libs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile"
  1290. for a in ${CMAKE_CXX_SOURCES}; do
  1291. src=`cmake_escape "${cmake_source_dir}/Source/${a}.cxx"`
  1292. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1293. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1294. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1295. done
  1296. for a in ${CMAKE_C_SOURCES}; do
  1297. src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
  1298. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1299. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1300. done
  1301. for a in ${LexerParser_CXX_SOURCES}; do
  1302. src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.cxx"`
  1303. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1304. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1305. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1306. done
  1307. for a in ${LexerParser_C_SOURCES}; do
  1308. src=`cmake_escape "${cmake_source_dir}/Source/LexerParser/${a}.c"`
  1309. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1310. echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1311. done
  1312. for a in ${KWSYS_C_SOURCES}; do
  1313. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
  1314. src_flags=`eval echo \\${cmake_c_flags_\${a}}`
  1315. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1316. echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1317. done
  1318. for a in ${KWSYS_CXX_SOURCES}; do
  1319. src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.cxx"`
  1320. src_flags=`eval echo \\${cmake_cxx_flags_\${a}}`
  1321. echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1322. echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
  1323. done
  1324. for a in ${LIBUV_C_SOURCES}; do
  1325. src=`cmake_escape "${cmake_source_dir}/Utilities/cmlibuv/${a}"`
  1326. echo "uv-`cmake_obj ${a}` : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
  1327. echo " ${cmake_c_compiler} ${cmake_c_flags} ${uv_c_flags} -c ${src} -o uv-`cmake_obj ${a}`" >> "${cmake_bootstrap_dir}/Makefile"
  1328. done
  1329. echo '
  1330. rebuild_cache:
  1331. cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
  1332. ' >> "${cmake_bootstrap_dir}/Makefile"
  1333. # Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake.
  1334. echo '
  1335. # Generated by '"${cmake_source_dir}"'/bootstrap
  1336. # Default cmake settings. These may be overridden any settings below.
  1337. set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
  1338. set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE)
  1339. set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE)
  1340. set (CMAKE_BIN_DIR "'"${cmake_bin_dir}"'" CACHE PATH "Install location for binaries (relative to prefix)." FORCE)
  1341. set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE)
  1342. set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE)
  1343. ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1344. # Add configuration settings given as command-line options.
  1345. if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then
  1346. echo '
  1347. set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE)
  1348. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1349. fi
  1350. if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then
  1351. echo '
  1352. set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE)
  1353. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1354. fi
  1355. if [ "x${cmake_sphinx_man}" != "x" ]; then
  1356. echo '
  1357. set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE)
  1358. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1359. fi
  1360. if [ "x${cmake_sphinx_html}" != "x" ]; then
  1361. echo '
  1362. set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE)
  1363. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1364. fi
  1365. if [ "x${cmake_sphinx_qthelp}" != "x" ]; then
  1366. echo '
  1367. set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
  1368. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1369. fi
  1370. if [ "x${cmake_sphinx_build}" != "x" ]; then
  1371. echo '
  1372. set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
  1373. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1374. fi
  1375. if [ "x${cmake_sphinx_flags}" != "x" ]; then
  1376. echo '
  1377. set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE)
  1378. ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1379. fi
  1380. # Add user-specified settings. Handle relative-path case for
  1381. # specification of cmake_init_file.
  1382. (
  1383. cd "${cmake_binary_dir}"
  1384. if [ -f "${cmake_init_file}" ]; then
  1385. cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
  1386. fi
  1387. )
  1388. echo "---------------------------------------------"
  1389. # Run make to build bootstrap cmake
  1390. if [ "x${cmake_parallel_make}" != "x" ]; then
  1391. ${cmake_make_processor} ${cmake_make_flags}
  1392. else
  1393. ${cmake_make_processor}
  1394. fi
  1395. RES=$?
  1396. if [ "${RES}" -ne "0" ]; then
  1397. cmake_error 9 "Problem while running ${cmake_make_processor}"
  1398. fi
  1399. cd "${cmake_binary_dir}"
  1400. # Set C, CXX, and MAKE environment variables, so that real real cmake will be
  1401. # build with same compiler and make
  1402. CC="${cmake_c_compiler}"
  1403. CXX="${cmake_cxx_compiler}"
  1404. if [ -n "${cmake_ccache_enabled}" ]; then
  1405. CC="ccache ${CC}"
  1406. CXX="ccache ${CXX}"
  1407. fi
  1408. MAKE="${cmake_make_processor}"
  1409. export CC
  1410. export CXX
  1411. export MAKE
  1412. # Run bootstrap CMake to configure real CMake
  1413. cmake_options="-DCMAKE_BOOTSTRAP=1"
  1414. if [ -n "${cmake_verbose}" ]; then
  1415. cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1"
  1416. fi
  1417. "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@"
  1418. RES=$?
  1419. if [ "${RES}" -ne "0" ]; then
  1420. cmake_error 11 "Problem while running initial CMake"
  1421. fi
  1422. echo "---------------------------------------------"
  1423. # And we are done. Now just run make
  1424. echo "CMake has bootstrapped. Now run ${cmake_make_processor}."