CMakeLists.txt 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. include(CheckIncludeFile)
  4. # Check if we can build support for ELF parsing.
  5. if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
  6. CHECK_INCLUDE_FILES("stdint.h;elf_abi.h" HAVE_ELF_H)
  7. else()
  8. CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H)
  9. endif()
  10. if(HAVE_ELF_H)
  11. set(CMAKE_USE_ELF_PARSER 1)
  12. elseif(HAIKU)
  13. # On Haiku, we need to include elf32.h from the private headers
  14. set(CMake_HAIKU_INCLUDE_DIRS
  15. /boot/system/develop/headers/private/system
  16. /boot/system/develop/headers/private/system/arch/x86
  17. )
  18. set(CMAKE_REQUIRED_INCLUDES ${CMake_HAIKU_INCLUDE_DIRS})
  19. CHECK_INCLUDE_FILE("elf32.h" HAVE_ELF32_H)
  20. unset(CMAKE_REQUIRED_INCLUDES)
  21. if(HAVE_ELF32_H)
  22. set(CMAKE_USE_ELF_PARSER 1)
  23. else()
  24. unset(CMake_HAIKU_INCLUDE_DIRS)
  25. set(CMAKE_USE_ELF_PARSER)
  26. endif()
  27. else()
  28. set(CMAKE_USE_ELF_PARSER)
  29. endif()
  30. if(NOT CMake_DEFAULT_RECURSION_LIMIT)
  31. if(DEFINED ENV{DASHBOARD_TEST_FROM_CTEST})
  32. set(CMake_DEFAULT_RECURSION_LIMIT 100)
  33. elseif(MINGW)
  34. set(CMake_DEFAULT_RECURSION_LIMIT 400)
  35. else()
  36. set(CMake_DEFAULT_RECURSION_LIMIT 1000)
  37. endif()
  38. endif()
  39. if(APPLE)
  40. set(CMAKE_USE_MACH_PARSER 1)
  41. endif()
  42. set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR})
  43. if(WIN32)
  44. # ensure Unicode friendly APIs are used on Windows
  45. add_definitions(-DUNICODE -D_UNICODE)
  46. # minimize windows.h content
  47. add_definitions(-DWIN32_LEAN_AND_MEAN)
  48. endif()
  49. # configure the .dox.in file
  50. if(CMake_BUILD_DEVELOPER_REFERENCE)
  51. configure_file(
  52. "${CMake_SOURCE_DIR}/Source/dir.dox.in"
  53. "${CMake_BINARY_DIR}/Source/dir.dox"
  54. @ONLY
  55. )
  56. endif()
  57. # configure the .h file
  58. configure_file(
  59. "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in"
  60. "${CMake_BINARY_DIR}/Source/cmConfigure.h"
  61. )
  62. configure_file(
  63. "${CMake_SOURCE_DIR}/Source/cmVersionConfig.h.in"
  64. "${CMake_BINARY_DIR}/Source/cmVersionConfig.h"
  65. )
  66. configure_file(
  67. "${CMake_SOURCE_DIR}/Source/CPack/cmCPackConfigure.h.in"
  68. "${CMake_BINARY_DIR}/Source/CPack/cmCPackConfigure.h"
  69. )
  70. # Tell CMake executable in the build tree where to find the source tree.
  71. configure_file(
  72. "${CMake_SOURCE_DIR}/Source/CMakeSourceDir.txt.in"
  73. "${CMake_BINARY_DIR}/CMakeFiles/CMakeSourceDir.txt" @ONLY
  74. )
  75. # add the include path to find the .h
  76. include_directories(
  77. "${CMake_BINARY_DIR}/Source"
  78. "${CMake_SOURCE_DIR}/Source"
  79. "${CMake_SOURCE_DIR}/Source/LexerParser"
  80. ${CMAKE_ZLIB_INCLUDES}
  81. ${CMAKE_EXPAT_INCLUDES}
  82. ${CMAKE_TAR_INCLUDES}
  83. ${CMake_HAIKU_INCLUDE_DIRS}
  84. )
  85. # let cmake know it is supposed to use it
  86. add_definitions(-DCMAKE_BUILD_WITH_CMAKE)
  87. # Check if we can build the ELF parser.
  88. if(CMAKE_USE_ELF_PARSER)
  89. set(ELF_SRCS cmELF.h cmELF.cxx)
  90. endif()
  91. # Check if we can build the Mach-O parser.
  92. if(CMAKE_USE_MACH_PARSER)
  93. set(MACH_SRCS cmMachO.h cmMachO.cxx)
  94. endif()
  95. #
  96. # Sources for CMakeLib
  97. #
  98. set(SRCS
  99. # Lexers/Parsers
  100. LexerParser/cmCommandArgumentLexer.cxx
  101. LexerParser/cmCommandArgumentLexer.h
  102. LexerParser/cmCommandArgumentLexer.in.l
  103. LexerParser/cmCommandArgumentParser.cxx
  104. LexerParser/cmCommandArgumentParserTokens.h
  105. LexerParser/cmCommandArgumentParser.y
  106. LexerParser/cmDependsJavaLexer.cxx
  107. LexerParser/cmDependsJavaLexer.h
  108. LexerParser/cmDependsJavaLexer.in.l
  109. LexerParser/cmDependsJavaParser.cxx
  110. LexerParser/cmDependsJavaParserTokens.h
  111. LexerParser/cmDependsJavaParser.y
  112. LexerParser/cmExprLexer.cxx
  113. LexerParser/cmExprLexer.h
  114. LexerParser/cmExprLexer.in.l
  115. LexerParser/cmExprParser.cxx
  116. LexerParser/cmExprParserTokens.h
  117. LexerParser/cmExprParser.y
  118. LexerParser/cmFortranLexer.cxx
  119. LexerParser/cmFortranLexer.h
  120. LexerParser/cmFortranLexer.in.l
  121. LexerParser/cmFortranParser.cxx
  122. LexerParser/cmFortranParserTokens.h
  123. LexerParser/cmFortranParser.y
  124. LexerParser/cmListFileLexer.c
  125. LexerParser/cmListFileLexer.in.l
  126. cmAffinity.cxx
  127. cmAffinity.h
  128. cmAlgorithms.h
  129. cmArchiveWrite.cxx
  130. cmArgumentParser.cxx
  131. cmArgumentParser.h
  132. cmBase32.cxx
  133. cmBinUtilsLinker.cxx
  134. cmBinUtilsLinker.h
  135. cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx
  136. cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
  137. cmBinUtilsLinuxELFLinker.cxx
  138. cmBinUtilsLinuxELFLinker.h
  139. cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
  140. cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
  141. cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx
  142. cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
  143. cmBinUtilsMacOSMachOLinker.cxx
  144. cmBinUtilsMacOSMachOLinker.h
  145. cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
  146. cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
  147. cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
  148. cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
  149. cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx
  150. cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
  151. cmBinUtilsWindowsPELinker.cxx
  152. cmBinUtilsWindowsPELinker.h
  153. cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
  154. cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
  155. cmCacheManager.cxx
  156. cmCacheManager.h
  157. cmCLocaleEnvironmentScope.h
  158. cmCLocaleEnvironmentScope.cxx
  159. cmCommandArgumentParserHelper.cxx
  160. cmCommonTargetGenerator.cxx
  161. cmCommonTargetGenerator.h
  162. cmComputeComponentGraph.cxx
  163. cmComputeComponentGraph.h
  164. cmComputeLinkDepends.cxx
  165. cmComputeLinkDepends.h
  166. cmComputeLinkInformation.cxx
  167. cmComputeLinkInformation.h
  168. cmComputeTargetDepends.h
  169. cmComputeTargetDepends.cxx
  170. cmCPackPropertiesGenerator.h
  171. cmCPackPropertiesGenerator.cxx
  172. cmCryptoHash.cxx
  173. cmCryptoHash.h
  174. cmCurl.cxx
  175. cmCurl.h
  176. cmCustomCommand.cxx
  177. cmCustomCommand.h
  178. cmCustomCommandGenerator.cxx
  179. cmCustomCommandGenerator.h
  180. cmDefinitions.cxx
  181. cmDefinitions.h
  182. cmDepends.cxx
  183. cmDepends.h
  184. cmDependsC.cxx
  185. cmDependsC.h
  186. cmDependsFortran.cxx
  187. cmDependsFortran.h
  188. cmDependsJava.cxx
  189. cmDependsJava.h
  190. cmDependsJavaParserHelper.cxx
  191. cmDependsJavaParserHelper.h
  192. cmDocumentation.cxx
  193. cmDocumentationFormatter.cxx
  194. cmDocumentationSection.cxx
  195. cmDynamicLoader.cxx
  196. cmDynamicLoader.h
  197. ${ELF_SRCS}
  198. cmExprParserHelper.cxx
  199. cmExportBuildAndroidMKGenerator.h
  200. cmExportBuildAndroidMKGenerator.cxx
  201. cmExportBuildFileGenerator.h
  202. cmExportBuildFileGenerator.cxx
  203. cmExportFileGenerator.h
  204. cmExportFileGenerator.cxx
  205. cmExportInstallAndroidMKGenerator.h
  206. cmExportInstallAndroidMKGenerator.cxx
  207. cmExportInstallFileGenerator.h
  208. cmExportInstallFileGenerator.cxx
  209. cmExportTryCompileFileGenerator.h
  210. cmExportTryCompileFileGenerator.cxx
  211. cmExportSet.h
  212. cmExportSet.cxx
  213. cmExportSetMap.h
  214. cmExportSetMap.cxx
  215. cmExternalMakefileProjectGenerator.cxx
  216. cmExternalMakefileProjectGenerator.h
  217. cmExtraCodeBlocksGenerator.cxx
  218. cmExtraCodeBlocksGenerator.h
  219. cmExtraCodeLiteGenerator.cxx
  220. cmExtraCodeLiteGenerator.h
  221. cmExtraEclipseCDT4Generator.cxx
  222. cmExtraEclipseCDT4Generator.h
  223. cmExtraKateGenerator.cxx
  224. cmExtraKateGenerator.h
  225. cmExtraSublimeTextGenerator.cxx
  226. cmExtraSublimeTextGenerator.h
  227. cmFileAPI.cxx
  228. cmFileAPI.h
  229. cmFileAPICache.cxx
  230. cmFileAPICache.h
  231. cmFileAPICodemodel.cxx
  232. cmFileAPICodemodel.h
  233. cmFileAPICMakeFiles.cxx
  234. cmFileAPICMakeFiles.h
  235. cmFileCopier.cxx
  236. cmFileCopier.h
  237. cmFileInstaller.cxx
  238. cmFileInstaller.h
  239. cmFileLock.cxx
  240. cmFileLock.h
  241. cmFileLockPool.cxx
  242. cmFileLockPool.h
  243. cmFileLockResult.cxx
  244. cmFileLockResult.h
  245. cmFilePathChecksum.cxx
  246. cmFilePathChecksum.h
  247. cmFileTime.cxx
  248. cmFileTime.h
  249. cmFileTimeCache.cxx
  250. cmFileTimeCache.h
  251. cmFileTimes.cxx
  252. cmFileTimes.h
  253. cmFortranParserImpl.cxx
  254. cmFSPermissions.cxx
  255. cmFSPermissions.h
  256. cmGeneratedFileStream.cxx
  257. cmGeneratorExpressionContext.cxx
  258. cmGeneratorExpressionContext.h
  259. cmGeneratorExpressionDAGChecker.cxx
  260. cmGeneratorExpressionDAGChecker.h
  261. cmGeneratorExpressionEvaluationFile.cxx
  262. cmGeneratorExpressionEvaluationFile.h
  263. cmGeneratorExpressionEvaluator.cxx
  264. cmGeneratorExpressionEvaluator.h
  265. cmGeneratorExpressionLexer.cxx
  266. cmGeneratorExpressionLexer.h
  267. cmGeneratorExpressionNode.cxx
  268. cmGeneratorExpressionNode.h
  269. cmGeneratorExpressionParser.cxx
  270. cmGeneratorExpressionParser.h
  271. cmGeneratorExpression.cxx
  272. cmGeneratorExpression.h
  273. cmGeneratorTarget.cxx
  274. cmGeneratorTarget.h
  275. cmGetPipes.cxx
  276. cmGetPipes.h
  277. cmGlobalCommonGenerator.cxx
  278. cmGlobalCommonGenerator.h
  279. cmGlobalGenerator.cxx
  280. cmGlobalGenerator.h
  281. cmGlobalGeneratorFactory.h
  282. cmGlobalUnixMakefileGenerator3.cxx
  283. cmGlobalUnixMakefileGenerator3.h
  284. cmGlobVerificationManager.cxx
  285. cmGlobVerificationManager.h
  286. cmGraphAdjacencyList.h
  287. cmGraphVizWriter.cxx
  288. cmGraphVizWriter.h
  289. cmInstallGenerator.h
  290. cmInstallGenerator.cxx
  291. cmInstallExportGenerator.cxx
  292. cmInstalledFile.h
  293. cmInstalledFile.cxx
  294. cmInstallFilesGenerator.h
  295. cmInstallFilesGenerator.cxx
  296. cmInstallScriptGenerator.h
  297. cmInstallScriptGenerator.cxx
  298. cmInstallSubdirectoryGenerator.h
  299. cmInstallSubdirectoryGenerator.cxx
  300. cmInstallTargetGenerator.h
  301. cmInstallTargetGenerator.cxx
  302. cmInstallDirectoryGenerator.h
  303. cmInstallDirectoryGenerator.cxx
  304. cmLDConfigLDConfigTool.cxx
  305. cmLDConfigLDConfigTool.h
  306. cmLDConfigTool.cxx
  307. cmLDConfigTool.h
  308. cmLinkedTree.h
  309. cmLinkItem.cxx
  310. cmLinkItem.h
  311. cmLinkLineComputer.cxx
  312. cmLinkLineComputer.h
  313. cmLinkLineDeviceComputer.cxx
  314. cmLinkLineDeviceComputer.h
  315. cmListFileCache.cxx
  316. cmListFileCache.h
  317. cmLocalCommonGenerator.cxx
  318. cmLocalCommonGenerator.h
  319. cmLocalGenerator.cxx
  320. cmLocalGenerator.h
  321. cmRulePlaceholderExpander.cxx
  322. cmRulePlaceholderExpander.h
  323. cmLocalUnixMakefileGenerator3.cxx
  324. cmLocale.h
  325. ${MACH_SRCS}
  326. cmMakefile.cxx
  327. cmMakefile.h
  328. cmMakefileTargetGenerator.cxx
  329. cmMakefileExecutableTargetGenerator.cxx
  330. cmMakefileLibraryTargetGenerator.cxx
  331. cmMakefileUtilityTargetGenerator.cxx
  332. cmMessageType.h
  333. cmMessenger.cxx
  334. cmMessenger.h
  335. cmMSVC60LinkLineComputer.cxx
  336. cmMSVC60LinkLineComputer.h
  337. cmOSXBundleGenerator.cxx
  338. cmOSXBundleGenerator.h
  339. cmOutputConverter.cxx
  340. cmOutputConverter.h
  341. cmNewLineStyle.h
  342. cmNewLineStyle.cxx
  343. cmOrderDirectories.cxx
  344. cmOrderDirectories.h
  345. cmPolicies.h
  346. cmPolicies.cxx
  347. cmProcessOutput.cxx
  348. cmProcessOutput.h
  349. cmProcessTools.cxx
  350. cmProcessTools.h
  351. cmProperty.h
  352. cmPropertyDefinition.cxx
  353. cmPropertyDefinition.h
  354. cmPropertyDefinitionMap.cxx
  355. cmPropertyDefinitionMap.h
  356. cmPropertyMap.cxx
  357. cmPropertyMap.h
  358. cmQtAutoGen.cxx
  359. cmQtAutoGen.h
  360. cmQtAutoGenerator.cxx
  361. cmQtAutoGenerator.h
  362. cmQtAutoGenGlobalInitializer.cxx
  363. cmQtAutoGenGlobalInitializer.h
  364. cmQtAutoGenInitializer.cxx
  365. cmQtAutoGenInitializer.h
  366. cmQtAutoMocUic.cxx
  367. cmQtAutoMocUic.h
  368. cmQtAutoRcc.cxx
  369. cmQtAutoRcc.h
  370. cmRST.cxx
  371. cmRST.h
  372. cmRuntimeDependencyArchive.cxx
  373. cmRuntimeDependencyArchive.h
  374. cmScriptGenerator.h
  375. cmScriptGenerator.cxx
  376. cmSourceFile.cxx
  377. cmSourceFile.h
  378. cmSourceFileLocation.cxx
  379. cmSourceFileLocation.h
  380. cmSourceFileLocationKind.h
  381. cmSourceGroup.cxx
  382. cmSourceGroup.h
  383. cmState.cxx
  384. cmState.h
  385. cmStateDirectory.cxx
  386. cmStateDirectory.h
  387. cmStateSnapshot.cxx
  388. cmStateSnapshot.h
  389. cmStateTypes.h
  390. cmStringAlgorithms.cxx
  391. cmStringAlgorithms.h
  392. cmSystemTools.cxx
  393. cmSystemTools.h
  394. cmTarget.cxx
  395. cmTarget.h
  396. cmTargetPropertyComputer.cxx
  397. cmTargetPropertyComputer.h
  398. cmTargetExport.h
  399. cmTest.cxx
  400. cmTest.h
  401. cmTestGenerator.cxx
  402. cmTestGenerator.h
  403. cmUuid.cxx
  404. cmUVHandlePtr.cxx
  405. cmUVHandlePtr.h
  406. cmUVProcessChain.cxx
  407. cmUVProcessChain.h
  408. cmUVStreambuf.h
  409. cmUVSignalHackRAII.h
  410. cmVariableWatch.cxx
  411. cmVariableWatch.h
  412. cmVersion.cxx
  413. cmVersion.h
  414. cmWorkerPool.cxx
  415. cmWorkerPool.h
  416. cmWorkingDirectory.cxx
  417. cmWorkingDirectory.h
  418. cmXMLParser.cxx
  419. cmXMLParser.h
  420. cmXMLSafe.cxx
  421. cmXMLSafe.h
  422. cmXMLWriter.cxx
  423. cmXMLWriter.h
  424. cmake.cxx
  425. cmake.h
  426. cm_string_view.cxx
  427. cm_string_view.hxx
  428. cm_static_string_view.hxx
  429. cmCommand.cxx
  430. cmCommand.h
  431. cmCommands.cxx
  432. cmCommands.h
  433. cmAddCompileDefinitionsCommand.cxx
  434. cmAddCompileDefinitionsCommand.h
  435. cmAddCompileOptionsCommand.cxx
  436. cmAddCompileOptionsCommand.h
  437. cmAddLinkOptionsCommand.cxx
  438. cmAddLinkOptionsCommand.h
  439. cmAddCustomCommandCommand.cxx
  440. cmAddCustomCommandCommand.h
  441. cmAddCustomTargetCommand.cxx
  442. cmAddCustomTargetCommand.h
  443. cmAddDefinitionsCommand.cxx
  444. cmAddDefinitionsCommand.h
  445. cmAddDependenciesCommand.cxx
  446. cmAddDependenciesCommand.h
  447. cmAddExecutableCommand.cxx
  448. cmAddExecutableCommand.h
  449. cmAddLibraryCommand.cxx
  450. cmAddLibraryCommand.h
  451. cmAddSubDirectoryCommand.cxx
  452. cmAddSubDirectoryCommand.h
  453. cmAddTestCommand.cxx
  454. cmAddTestCommand.h
  455. cmAuxSourceDirectoryCommand.cxx
  456. cmAuxSourceDirectoryCommand.h
  457. cmBreakCommand.cxx
  458. cmBreakCommand.h
  459. cmBuildCommand.cxx
  460. cmBuildCommand.h
  461. cmBuildNameCommand.cxx
  462. cmBuildNameCommand.h
  463. cmCMakeHostSystemInformationCommand.cxx
  464. cmCMakeHostSystemInformationCommand.h
  465. cmCMakeMinimumRequired.cxx
  466. cmCMakeMinimumRequired.h
  467. cmCMakePolicyCommand.cxx
  468. cmCMakePolicyCommand.h
  469. cmConditionEvaluator.cxx
  470. cmConditionEvaluator.h
  471. cmConfigureFileCommand.cxx
  472. cmConfigureFileCommand.h
  473. cmContinueCommand.cxx
  474. cmContinueCommand.h
  475. cmCoreTryCompile.cxx
  476. cmCoreTryCompile.h
  477. cmCreateTestSourceList.cxx
  478. cmCreateTestSourceList.h
  479. cmDefinePropertyCommand.cxx
  480. cmDefinePropertyCommand.h
  481. cmDisallowedCommand.cxx
  482. cmDisallowedCommand.h
  483. cmEnableLanguageCommand.cxx
  484. cmEnableLanguageCommand.h
  485. cmEnableTestingCommand.cxx
  486. cmEnableTestingCommand.h
  487. cmExecProgramCommand.cxx
  488. cmExecProgramCommand.h
  489. cmExecuteProcessCommand.cxx
  490. cmExecuteProcessCommand.h
  491. cmExpandedCommandArgument.cxx
  492. cmExpandedCommandArgument.h
  493. cmExportCommand.cxx
  494. cmExportCommand.h
  495. cmExportLibraryDependenciesCommand.cxx
  496. cmExportLibraryDependenciesCommand.h
  497. cmFLTKWrapUICommand.cxx
  498. cmFLTKWrapUICommand.h
  499. cmFileCommand.cxx
  500. cmFileCommand.h
  501. cmFindBase.cxx
  502. cmFindBase.h
  503. cmFindCommon.cxx
  504. cmFindCommon.h
  505. cmFindFileCommand.cxx
  506. cmFindFileCommand.h
  507. cmFindLibraryCommand.cxx
  508. cmFindLibraryCommand.h
  509. cmFindPackageCommand.cxx
  510. cmFindPackageCommand.h
  511. cmFindPathCommand.cxx
  512. cmFindPathCommand.h
  513. cmFindProgramCommand.cxx
  514. cmFindProgramCommand.h
  515. cmForEachCommand.cxx
  516. cmForEachCommand.h
  517. cmFunctionBlocker.cxx
  518. cmFunctionBlocker.h
  519. cmFunctionCommand.cxx
  520. cmFunctionCommand.h
  521. cmGetCMakePropertyCommand.cxx
  522. cmGetCMakePropertyCommand.h
  523. cmGetDirectoryPropertyCommand.cxx
  524. cmGetDirectoryPropertyCommand.h
  525. cmGetFilenameComponentCommand.cxx
  526. cmGetFilenameComponentCommand.h
  527. cmGetPropertyCommand.cxx
  528. cmGetPropertyCommand.h
  529. cmGetSourceFilePropertyCommand.cxx
  530. cmGetSourceFilePropertyCommand.h
  531. cmGetTargetPropertyCommand.cxx
  532. cmGetTargetPropertyCommand.h
  533. cmGetTestPropertyCommand.cxx
  534. cmGetTestPropertyCommand.h
  535. cmHexFileConverter.cxx
  536. cmHexFileConverter.h
  537. cmIfCommand.cxx
  538. cmIfCommand.h
  539. cmIncludeCommand.cxx
  540. cmIncludeCommand.h
  541. cmIncludeDirectoryCommand.cxx
  542. cmIncludeDirectoryCommand.h
  543. cmIncludeExternalMSProjectCommand.cxx
  544. cmIncludeExternalMSProjectCommand.h
  545. cmIncludeGuardCommand.cxx
  546. cmIncludeGuardCommand.h
  547. cmIncludeRegularExpressionCommand.cxx
  548. cmIncludeRegularExpressionCommand.h
  549. cmInstallCommand.cxx
  550. cmInstallCommand.h
  551. cmInstallCommandArguments.cxx
  552. cmInstallCommandArguments.h
  553. cmInstallFilesCommand.cxx
  554. cmInstallFilesCommand.h
  555. cmInstallProgramsCommand.cxx
  556. cmInstallProgramsCommand.h
  557. cmInstallTargetsCommand.cxx
  558. cmInstallTargetsCommand.h
  559. cmLinkDirectoriesCommand.cxx
  560. cmLinkDirectoriesCommand.h
  561. cmLinkLibrariesCommand.cxx
  562. cmLinkLibrariesCommand.h
  563. cmListCommand.cxx
  564. cmListCommand.h
  565. cmLoadCacheCommand.cxx
  566. cmLoadCacheCommand.h
  567. cmLoadCommandCommand.cxx
  568. cmLoadCommandCommand.h
  569. cmMacroCommand.cxx
  570. cmMacroCommand.h
  571. cmMakeDirectoryCommand.cxx
  572. cmMakeDirectoryCommand.h
  573. cmMarkAsAdvancedCommand.cxx
  574. cmMarkAsAdvancedCommand.h
  575. cmMathCommand.cxx
  576. cmMathCommand.h
  577. cmMessageCommand.cxx
  578. cmMessageCommand.h
  579. cmOptionCommand.cxx
  580. cmOptionCommand.h
  581. cmOutputRequiredFilesCommand.cxx
  582. cmOutputRequiredFilesCommand.h
  583. cmParseArgumentsCommand.cxx
  584. cmParseArgumentsCommand.h
  585. cmPathLabel.cxx
  586. cmPathLabel.h
  587. cmProjectCommand.cxx
  588. cmProjectCommand.h
  589. cmQTWrapCPPCommand.cxx
  590. cmQTWrapCPPCommand.h
  591. cmQTWrapUICommand.cxx
  592. cmQTWrapUICommand.h
  593. cmRemoveCommand.cxx
  594. cmRemoveCommand.h
  595. cmRemoveDefinitionsCommand.cxx
  596. cmRemoveDefinitionsCommand.h
  597. cmReturnCommand.cxx
  598. cmReturnCommand.h
  599. cmSearchPath.cxx
  600. cmSearchPath.h
  601. cmSeparateArgumentsCommand.cxx
  602. cmSeparateArgumentsCommand.h
  603. cmSetCommand.cxx
  604. cmSetCommand.h
  605. cmSetDirectoryPropertiesCommand.cxx
  606. cmSetDirectoryPropertiesCommand.h
  607. cmSetPropertyCommand.cxx
  608. cmSetPropertyCommand.h
  609. cmSetSourceFilesPropertiesCommand.cxx
  610. cmSetSourceFilesPropertiesCommand.h
  611. cmSetTargetPropertiesCommand.cxx
  612. cmSetTargetPropertiesCommand.h
  613. cmSetTestsPropertiesCommand.cxx
  614. cmSetTestsPropertiesCommand.h
  615. cmSiteNameCommand.cxx
  616. cmSiteNameCommand.h
  617. cmSourceGroupCommand.cxx
  618. cmSourceGroupCommand.h
  619. cmString.cxx
  620. cmString.hxx
  621. cmStringReplaceHelper.cxx
  622. cmStringCommand.cxx
  623. cmStringCommand.h
  624. cmSubcommandTable.cxx
  625. cmSubcommandTable.h
  626. cmSubdirCommand.cxx
  627. cmSubdirCommand.h
  628. cmSubdirDependsCommand.cxx
  629. cmSubdirDependsCommand.h
  630. cmTargetCompileDefinitionsCommand.cxx
  631. cmTargetCompileDefinitionsCommand.h
  632. cmTargetCompileFeaturesCommand.cxx
  633. cmTargetCompileFeaturesCommand.h
  634. cmTargetCompileOptionsCommand.cxx
  635. cmTargetCompileOptionsCommand.h
  636. cmTargetIncludeDirectoriesCommand.cxx
  637. cmTargetIncludeDirectoriesCommand.h
  638. cmTargetLinkOptionsCommand.cxx
  639. cmTargetLinkOptionsCommand.h
  640. cmTargetLinkDirectoriesCommand.cxx
  641. cmTargetLinkDirectoriesCommand.h
  642. cmTargetLinkLibrariesCommand.cxx
  643. cmTargetLinkLibrariesCommand.h
  644. cmTargetPropCommandBase.cxx
  645. cmTargetPropCommandBase.h
  646. cmTargetSourcesCommand.cxx
  647. cmTargetSourcesCommand.h
  648. cmTimestamp.cxx
  649. cmTimestamp.h
  650. cmTryCompileCommand.cxx
  651. cmTryCompileCommand.h
  652. cmTryRunCommand.cxx
  653. cmTryRunCommand.h
  654. cmUnsetCommand.cxx
  655. cmUnsetCommand.h
  656. cmUseMangledMesaCommand.cxx
  657. cmUseMangledMesaCommand.h
  658. cmUtilitySourceCommand.cxx
  659. cmUtilitySourceCommand.h
  660. cmVariableRequiresCommand.cxx
  661. cmVariableRequiresCommand.h
  662. cmVariableWatchCommand.cxx
  663. cmVariableWatchCommand.h
  664. cmWhileCommand.cxx
  665. cmWhileCommand.h
  666. cmWriteFileCommand.cxx
  667. cmWriteFileCommand.h
  668. cm_get_date.h
  669. cm_get_date.c
  670. cm_utf8.h
  671. cm_utf8.c
  672. cm_codecvt.hxx
  673. cm_codecvt.cxx
  674. cm_thread.hxx
  675. cmDuration.h
  676. cmDuration.cxx
  677. )
  678. SET_PROPERTY(SOURCE cmProcessOutput.cxx APPEND PROPERTY COMPILE_DEFINITIONS
  679. KWSYS_ENCODING_DEFAULT_CODEPAGE=${KWSYS_ENCODING_DEFAULT_CODEPAGE})
  680. # Xcode only works on Apple
  681. if(APPLE)
  682. set(SRCS ${SRCS}
  683. cmXCodeObject.cxx
  684. cmXCode21Object.cxx
  685. cmXCodeScheme.cxx
  686. cmGlobalXCodeGenerator.cxx
  687. cmGlobalXCodeGenerator.h
  688. cmLocalXCodeGenerator.cxx
  689. cmLocalXCodeGenerator.h)
  690. endif()
  691. if (WIN32)
  692. set(SRCS ${SRCS}
  693. cmCallVisualStudioMacro.cxx
  694. cmCallVisualStudioMacro.h
  695. bindexplib.cxx
  696. )
  697. if(NOT UNIX)
  698. set(SRCS ${SRCS}
  699. cmGlobalBorlandMakefileGenerator.cxx
  700. cmGlobalBorlandMakefileGenerator.h
  701. cmGlobalMSYSMakefileGenerator.cxx
  702. cmGlobalMinGWMakefileGenerator.cxx
  703. cmGlobalNMakeMakefileGenerator.cxx
  704. cmGlobalNMakeMakefileGenerator.h
  705. cmGlobalJOMMakefileGenerator.cxx
  706. cmGlobalJOMMakefileGenerator.h
  707. cmGlobalVisualStudio71Generator.cxx
  708. cmGlobalVisualStudio71Generator.h
  709. cmGlobalVisualStudio7Generator.cxx
  710. cmGlobalVisualStudio7Generator.h
  711. cmGlobalVisualStudio8Generator.cxx
  712. cmGlobalVisualStudio8Generator.h
  713. cmGlobalVisualStudio9Generator.cxx
  714. cmGlobalVisualStudio9Generator.h
  715. cmVisualStudioGeneratorOptions.h
  716. cmVisualStudioGeneratorOptions.cxx
  717. cmVisualStudio10TargetGenerator.h
  718. cmVisualStudio10TargetGenerator.cxx
  719. cmVisualStudio10ToolsetOptions.h
  720. cmVisualStudio10ToolsetOptions.cxx
  721. cmLocalVisualStudio10Generator.cxx
  722. cmLocalVisualStudio10Generator.h
  723. cmGlobalVisualStudio10Generator.h
  724. cmGlobalVisualStudio10Generator.cxx
  725. cmGlobalVisualStudio11Generator.h
  726. cmGlobalVisualStudio11Generator.cxx
  727. cmGlobalVisualStudio12Generator.h
  728. cmGlobalVisualStudio12Generator.cxx
  729. cmGlobalVisualStudio14Generator.h
  730. cmGlobalVisualStudio14Generator.cxx
  731. cmGlobalVisualStudioGenerator.cxx
  732. cmGlobalVisualStudioGenerator.h
  733. cmGlobalVisualStudioVersionedGenerator.h
  734. cmGlobalVisualStudioVersionedGenerator.cxx
  735. cmIDEFlagTable.h
  736. cmIDEOptions.cxx
  737. cmIDEOptions.h
  738. cmLocalVisualStudio7Generator.cxx
  739. cmLocalVisualStudio7Generator.h
  740. cmLocalVisualStudioGenerator.cxx
  741. cmLocalVisualStudioGenerator.h
  742. cmVisualStudioSlnData.h
  743. cmVisualStudioSlnData.cxx
  744. cmVisualStudioSlnParser.h
  745. cmVisualStudioSlnParser.cxx
  746. cmVisualStudioWCEPlatformParser.h
  747. cmVisualStudioWCEPlatformParser.cxx
  748. cmVSSetupHelper.cxx
  749. cmVSSetupHelper.h
  750. )
  751. # Add a manifest file to executables on Windows to allow for
  752. # GetVersion to work properly on Windows 8 and above.
  753. set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake.version.manifest)
  754. endif()
  755. endif ()
  756. # Watcom support
  757. if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
  758. set_property(SOURCE cmake.cxx APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_USE_WMAKE)
  759. list(APPEND SRCS
  760. cmGlobalWatcomWMakeGenerator.cxx
  761. cmGlobalWatcomWMakeGenerator.h
  762. )
  763. endif()
  764. # GHS support
  765. # Works only for windows and linux
  766. if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
  767. set(SRCS ${SRCS}
  768. cmGlobalGhsMultiGenerator.cxx
  769. cmGlobalGhsMultiGenerator.h
  770. cmLocalGhsMultiGenerator.cxx
  771. cmLocalGhsMultiGenerator.h
  772. cmGhsMultiTargetGenerator.cxx
  773. cmGhsMultiTargetGenerator.h
  774. cmGhsMultiGpj.cxx
  775. cmGhsMultiGpj.h
  776. )
  777. endif()
  778. # Ninja support
  779. set(SRCS ${SRCS}
  780. cmGlobalNinjaGenerator.cxx
  781. cmGlobalNinjaGenerator.h
  782. cmNinjaTypes.h
  783. cmLocalNinjaGenerator.cxx
  784. cmLocalNinjaGenerator.h
  785. cmNinjaTargetGenerator.cxx
  786. cmNinjaTargetGenerator.h
  787. cmNinjaNormalTargetGenerator.cxx
  788. cmNinjaNormalTargetGenerator.h
  789. cmNinjaUtilityTargetGenerator.cxx
  790. cmNinjaUtilityTargetGenerator.h
  791. cmNinjaLinkLineComputer.cxx
  792. cmNinjaLinkLineComputer.h
  793. cmNinjaLinkLineDeviceComputer.cxx
  794. cmNinjaLinkLineDeviceComputer.h
  795. )
  796. # Temporary variable for tools targets
  797. set(_tools)
  798. if(WIN32 AND NOT CYGWIN)
  799. set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
  800. add_executable(cmcldeps cmcldeps.cxx ${MANIFEST_FILE})
  801. list(APPEND _tools cmcldeps)
  802. target_link_libraries(cmcldeps CMakeLib)
  803. endif()
  804. foreach(v CURL_CA_BUNDLE CURL_CA_PATH)
  805. if(${v})
  806. set_property(SOURCE cmCurl.cxx APPEND PROPERTY COMPILE_DEFINITIONS ${v}="${${v}}")
  807. endif()
  808. endforeach()
  809. foreach(check
  810. STAT_HAS_ST_MTIM
  811. STAT_HAS_ST_MTIMESPEC
  812. )
  813. if(KWSYS_CXX_${check}_COMPILED) # abuse KWSys check cache entry
  814. set(CMake_${check} 1)
  815. else()
  816. set(CMake_${check} 0)
  817. endif()
  818. set_property(SOURCE cmFileTime.cxx APPEND PROPERTY
  819. COMPILE_DEFINITIONS CMake_${check}=${CMake_${check}})
  820. endforeach()
  821. # create a library used by the command line and the GUI
  822. add_library(CMakeLib ${SRCS})
  823. target_link_libraries(CMakeLib cmsys
  824. ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES}
  825. ${CMAKE_TAR_LIBRARIES}
  826. ${CMAKE_CURL_LIBRARIES}
  827. ${CMAKE_JSONCPP_LIBRARIES}
  828. ${CMAKE_LIBUV_LIBRARIES}
  829. ${CMAKE_LIBRHASH_LIBRARIES}
  830. ${CMake_KWIML_LIBRARIES}
  831. ${CMAKE_THREAD_LIBS_INIT}
  832. )
  833. if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
  834. # the atomic instructions are implemented using libatomic on some platforms,
  835. # so linking to that may be required
  836. check_library_exists(atomic __atomic_fetch_add_4 "" LIBATOMIC_NEEDED)
  837. if(LIBATOMIC_NEEDED)
  838. target_link_libraries(CMakeLib atomic)
  839. endif()
  840. endif()
  841. # On Apple we need CoreFoundation and CoreServices
  842. if(APPLE)
  843. target_link_libraries(CMakeLib "-framework CoreFoundation")
  844. target_link_libraries(CMakeLib "-framework CoreServices")
  845. endif()
  846. if(WIN32 AND NOT UNIX)
  847. # We need the rpcrt4 library on Windows.
  848. # We need the crypt32 library on Windows for crypto/cert APIs.
  849. target_link_libraries(CMakeLib rpcrt4 crypt32)
  850. endif()
  851. target_compile_definitions(CMakeLib PUBLIC ${CLANG_TIDY_DEFINITIONS})
  852. #
  853. # CTestLib
  854. #
  855. include_directories(
  856. "${CMake_SOURCE_DIR}/Source/CTest"
  857. ${CMAKE_CURL_INCLUDES}
  858. )
  859. #
  860. # Sources for CTestLib
  861. #
  862. set(CTEST_SRCS cmCTest.cxx
  863. CTest/cmProcess.cxx
  864. CTest/cmCTestBuildAndTestHandler.cxx
  865. CTest/cmCTestBuildCommand.cxx
  866. CTest/cmCTestBuildHandler.cxx
  867. CTest/cmCTestConfigureCommand.cxx
  868. CTest/cmCTestConfigureHandler.cxx
  869. CTest/cmCTestCoverageCommand.cxx
  870. CTest/cmCTestCoverageHandler.cxx
  871. CTest/cmCTestCurl.cxx
  872. CTest/cmParseMumpsCoverage.cxx
  873. CTest/cmParseCacheCoverage.cxx
  874. CTest/cmParseGTMCoverage.cxx
  875. CTest/cmParseJacocoCoverage.cxx
  876. CTest/cmParseBlanketJSCoverage.cxx
  877. CTest/cmParsePHPCoverage.cxx
  878. CTest/cmParseCoberturaCoverage.cxx
  879. CTest/cmParseDelphiCoverage.cxx
  880. CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
  881. CTest/cmCTestGenericHandler.cxx
  882. CTest/cmCTestHandlerCommand.cxx
  883. CTest/cmCTestLaunch.cxx
  884. CTest/cmCTestMemCheckCommand.cxx
  885. CTest/cmCTestMemCheckHandler.cxx
  886. CTest/cmCTestMultiProcessHandler.cxx
  887. CTest/cmCTestReadCustomFilesCommand.cxx
  888. CTest/cmCTestRunScriptCommand.cxx
  889. CTest/cmCTestRunTest.cxx
  890. CTest/cmCTestScriptHandler.cxx
  891. CTest/cmCTestSleepCommand.cxx
  892. CTest/cmCTestStartCommand.cxx
  893. CTest/cmCTestSubmitCommand.cxx
  894. CTest/cmCTestSubmitHandler.cxx
  895. CTest/cmCTestTestCommand.cxx
  896. CTest/cmCTestTestHandler.cxx
  897. CTest/cmCTestUpdateCommand.cxx
  898. CTest/cmCTestUpdateHandler.cxx
  899. CTest/cmCTestUploadCommand.cxx
  900. CTest/cmCTestUploadHandler.cxx
  901. CTest/cmCTestVC.cxx
  902. CTest/cmCTestVC.h
  903. CTest/cmCTestGlobalVC.cxx
  904. CTest/cmCTestGlobalVC.h
  905. CTest/cmCTestCVS.cxx
  906. CTest/cmCTestCVS.h
  907. CTest/cmCTestSVN.cxx
  908. CTest/cmCTestSVN.h
  909. CTest/cmCTestBZR.cxx
  910. CTest/cmCTestBZR.h
  911. CTest/cmCTestGIT.cxx
  912. CTest/cmCTestGIT.h
  913. CTest/cmCTestHG.cxx
  914. CTest/cmCTestHG.h
  915. CTest/cmCTestP4.cxx
  916. CTest/cmCTestP4.h
  917. )
  918. # Build CTestLib
  919. add_library(CTestLib ${CTEST_SRCS})
  920. target_link_libraries(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES})
  921. #
  922. # CPack
  923. #
  924. include_directories(
  925. "${CMake_SOURCE_DIR}/Source/CPack"
  926. )
  927. #
  928. # Sources for CPack
  929. #
  930. set(CPACK_SRCS
  931. CPack/cmCPackArchiveGenerator.cxx
  932. CPack/cmCPackComponentGroup.cxx
  933. CPack/cmCPackDebGenerator.cxx
  934. CPack/cmCPackExternalGenerator.cxx
  935. CPack/cmCPackGeneratorFactory.cxx
  936. CPack/cmCPackGenerator.cxx
  937. CPack/cmCPackLog.cxx
  938. CPack/cmCPackNSISGenerator.cxx
  939. CPack/cmCPackNuGetGenerator.cxx
  940. CPack/cmCPackSTGZGenerator.cxx
  941. CPack/cmCPackTGZGenerator.cxx
  942. CPack/cmCPackTXZGenerator.cxx
  943. CPack/cmCPackTarBZip2Generator.cxx
  944. CPack/cmCPackTarCompressGenerator.cxx
  945. CPack/cmCPackZIPGenerator.cxx
  946. CPack/cmCPack7zGenerator.cxx
  947. )
  948. # CPack IFW generator
  949. set(CPACK_SRCS ${CPACK_SRCS}
  950. CPack/IFW/cmCPackIFWCommon.cxx
  951. CPack/IFW/cmCPackIFWCommon.h
  952. CPack/IFW/cmCPackIFWGenerator.cxx
  953. CPack/IFW/cmCPackIFWGenerator.h
  954. CPack/IFW/cmCPackIFWInstaller.cxx
  955. CPack/IFW/cmCPackIFWInstaller.h
  956. CPack/IFW/cmCPackIFWPackage.cxx
  957. CPack/IFW/cmCPackIFWPackage.h
  958. CPack/IFW/cmCPackIFWRepository.cxx
  959. CPack/IFW/cmCPackIFWRepository.h
  960. )
  961. if(CYGWIN)
  962. set(CPACK_SRCS ${CPACK_SRCS}
  963. CPack/cmCPackCygwinBinaryGenerator.cxx
  964. CPack/cmCPackCygwinSourceGenerator.cxx
  965. )
  966. endif()
  967. option(CPACK_ENABLE_FREEBSD_PKG "Add FreeBSD pkg(8) generator to CPack." OFF)
  968. if(UNIX)
  969. set(CPACK_SRCS ${CPACK_SRCS}
  970. CPack/cmCPackRPMGenerator.cxx
  971. )
  972. # Optionally, try to use pkg(8)
  973. if(CPACK_ENABLE_FREEBSD_PKG)
  974. # On UNIX, you may find FreeBSD's pkg(8) and attendant
  975. # library -- it can be used on FreeBSD, Dragonfly, NetBSD,
  976. # OpenBSD and also Linux and OSX. Look for the header and
  977. # the library; it's a warning on FreeBSD if they're not
  978. # found, and informational on other platforms.
  979. find_path(FREEBSD_PKG_INCLUDE_DIRS "pkg.h")
  980. if(FREEBSD_PKG_INCLUDE_DIRS)
  981. find_library(FREEBSD_PKG_LIBRARIES
  982. pkg
  983. DOC "FreeBSD pkg(8) library")
  984. if(FREEBSD_PKG_LIBRARIES)
  985. set(CPACK_SRCS ${CPACK_SRCS}
  986. CPack/cmCPackFreeBSDGenerator.cxx
  987. )
  988. endif()
  989. endif()
  990. if (NOT FREEBSD_PKG_INCLUDE_DIRS OR NOT FREEBSD_PKG_LIBRARIES)
  991. message(FATAL_ERROR "CPack needs libpkg(3) to produce FreeBSD packages natively.")
  992. endif()
  993. else()
  994. set(FREEBSD_PKG_INCLUDE_DIRS NOTFOUND)
  995. set(FREEBSD_PKG_LIBRARIES NOTFOUND)
  996. endif()
  997. endif()
  998. if(CYGWIN)
  999. find_package(LibUUID)
  1000. endif()
  1001. if(WIN32 OR (CYGWIN AND LibUUID_FOUND))
  1002. set(CPACK_SRCS ${CPACK_SRCS}
  1003. CPack/WiX/cmCMakeToWixPath.cxx
  1004. CPack/WiX/cmCMakeToWixPath.h
  1005. CPack/WiX/cmCPackWIXGenerator.cxx
  1006. CPack/WiX/cmCPackWIXGenerator.h
  1007. CPack/WiX/cmWIXAccessControlList.cxx
  1008. CPack/WiX/cmWIXAccessControlList.h
  1009. CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
  1010. CPack/WiX/cmWIXDirectoriesSourceWriter.h
  1011. CPack/WiX/cmWIXFeaturesSourceWriter.cxx
  1012. CPack/WiX/cmWIXFeaturesSourceWriter.h
  1013. CPack/WiX/cmWIXFilesSourceWriter.cxx
  1014. CPack/WiX/cmWIXFilesSourceWriter.h
  1015. CPack/WiX/cmWIXPatch.cxx
  1016. CPack/WiX/cmWIXPatch.h
  1017. CPack/WiX/cmWIXPatchParser.cxx
  1018. CPack/WiX/cmWIXPatchParser.h
  1019. CPack/WiX/cmWIXRichTextFormatWriter.cxx
  1020. CPack/WiX/cmWIXRichTextFormatWriter.h
  1021. CPack/WiX/cmWIXShortcut.cxx
  1022. CPack/WiX/cmWIXShortcut.h
  1023. CPack/WiX/cmWIXSourceWriter.cxx
  1024. CPack/WiX/cmWIXSourceWriter.h
  1025. )
  1026. endif()
  1027. if(APPLE)
  1028. set(CPACK_SRCS ${CPACK_SRCS}
  1029. CPack/cmCPackBundleGenerator.cxx
  1030. CPack/cmCPackDragNDropGenerator.cxx
  1031. CPack/cmCPackOSXX11Generator.cxx
  1032. CPack/cmCPackPKGGenerator.cxx
  1033. CPack/cmCPackPackageMakerGenerator.cxx
  1034. CPack/cmCPackProductBuildGenerator.cxx
  1035. )
  1036. endif()
  1037. # Build CPackLib
  1038. add_library(CPackLib ${CPACK_SRCS})
  1039. target_link_libraries(CPackLib CMakeLib)
  1040. if(APPLE)
  1041. # Some compilers produce errors in the CoreServices framework headers.
  1042. # Ideally such errors should be fixed by either the compiler vendor
  1043. # or the framework source, but we try to workaround it and build anyway.
  1044. # If it does not work, build with reduced functionality and warn.
  1045. check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices)
  1046. if(HAVE_CoreServices)
  1047. set_property(SOURCE CPack/cmCPackDragNDropGenerator.cxx PROPERTY COMPILE_DEFINITIONS HAVE_CoreServices)
  1048. target_link_libraries(CPackLib "-framework CoreServices")
  1049. else()
  1050. message(WARNING "This compiler does not appear to support\n"
  1051. " #include <CoreServices/CoreServices.h>\n"
  1052. "Some CPack functionality may be limited.\n"
  1053. "See CMakeFiles/CMakeError.log for details of the failure.")
  1054. endif()
  1055. endif()
  1056. if(CYGWIN AND LibUUID_FOUND)
  1057. target_link_libraries(CPackLib ${LibUUID_LIBRARIES})
  1058. include_directories(CPackLib ${LibUUID_INCLUDE_DIRS})
  1059. set_property(SOURCE CPack/cmCPackGeneratorFactory.cxx PROPERTY COMPILE_DEFINITIONS HAVE_LIBUUID)
  1060. endif()
  1061. if(CPACK_ENABLE_FREEBSD_PKG AND FREEBSD_PKG_INCLUDE_DIRS AND FREEBSD_PKG_LIBRARIES)
  1062. target_link_libraries(CPackLib ${FREEBSD_PKG_LIBRARIES})
  1063. include_directories(${FREEBSD_PKG_INCLUDE_DIRS})
  1064. add_definitions(-DHAVE_FREEBSD_PKG)
  1065. endif()
  1066. if(APPLE)
  1067. add_executable(OSXScriptLauncher
  1068. CPack/OSXScriptLauncher.cxx)
  1069. target_link_libraries(OSXScriptLauncher cmsys)
  1070. target_link_libraries(OSXScriptLauncher "-framework CoreFoundation")
  1071. endif()
  1072. # Build CMake executable
  1073. add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE})
  1074. list(APPEND _tools cmake)
  1075. target_link_libraries(cmake CMakeLib)
  1076. add_library(CMakeServerLib
  1077. cmConnection.h cmConnection.cxx
  1078. cmFileMonitor.cxx cmFileMonitor.h
  1079. cmJsonObjectDictionary.h
  1080. cmJsonObjects.h
  1081. cmJsonObjects.cxx
  1082. cmPipeConnection.cxx cmPipeConnection.h
  1083. cmServer.cxx cmServer.h
  1084. cmServerConnection.cxx cmServerConnection.h
  1085. cmServerProtocol.cxx cmServerProtocol.h
  1086. )
  1087. target_link_libraries(CMakeServerLib CMakeLib)
  1088. target_link_libraries(cmake CMakeServerLib)
  1089. # Build CTest executable
  1090. add_executable(ctest ctest.cxx ${MANIFEST_FILE})
  1091. list(APPEND _tools ctest)
  1092. target_link_libraries(ctest CTestLib)
  1093. # Build CPack executable
  1094. add_executable(cpack CPack/cpack.cxx ${MANIFEST_FILE})
  1095. list(APPEND _tools cpack)
  1096. target_link_libraries(cpack CPackLib)
  1097. # Curses GUI
  1098. if(BUILD_CursesDialog)
  1099. include(${CMake_SOURCE_DIR}/Source/CursesDialog/CMakeLists.txt)
  1100. endif()
  1101. # Qt GUI
  1102. option(BUILD_QtDialog "Build Qt dialog for CMake" FALSE)
  1103. if(BUILD_QtDialog)
  1104. add_subdirectory(QtDialog)
  1105. endif()
  1106. include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
  1107. include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
  1108. if(WIN32)
  1109. # Compute the binary version that appears in the RC file. Version
  1110. # components in the RC file are 16-bit integers so we may have to
  1111. # split the patch component.
  1112. if(CMake_VERSION_PATCH MATCHES "^([0-9]+)([0-9][0-9][0-9][0-9])$")
  1113. set(CMake_RCVERSION_YEAR "${CMAKE_MATCH_1}")
  1114. set(CMake_RCVERSION_MONTH_DAY "${CMAKE_MATCH_2}")
  1115. string(REGEX REPLACE "^0+" "" CMake_RCVERSION_MONTH_DAY "${CMake_RCVERSION_MONTH_DAY}")
  1116. set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMake_RCVERSION_YEAR},${CMake_RCVERSION_MONTH_DAY})
  1117. unset(CMake_RCVERSION_MONTH_DAY)
  1118. unset(CMake_RCVERSION_YEAR)
  1119. else()
  1120. set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMake_VERSION_PATCH})
  1121. endif()
  1122. set(CMake_RCVERSION_STR ${CMake_VERSION})
  1123. # Add Windows executable version information.
  1124. configure_file("CMakeVersion.rc.in" "CMakeVersion.rc" @ONLY)
  1125. # We use a separate object library for this to work around a limitation of
  1126. # MinGW's windres tool with spaces in the path to the include directories.
  1127. add_library(CMakeVersion OBJECT "${CMAKE_CURRENT_BINARY_DIR}/CMakeVersion.rc")
  1128. set_property(TARGET CMakeVersion PROPERTY INCLUDE_DIRECTORIES "")
  1129. foreach(_tool ${_tools})
  1130. target_sources(${_tool} PRIVATE $<TARGET_OBJECTS:CMakeVersion>)
  1131. endforeach()
  1132. endif()
  1133. # Install tools
  1134. foreach(_tool ${_tools})
  1135. CMake_OPTIONAL_COMPONENT(${_tool})
  1136. install(TARGETS ${_tool} DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT})
  1137. endforeach()
  1138. install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include)
  1139. # Unset temporary variables
  1140. unset(_tools)