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