bootstrap 48 KB

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