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