CMakeLists.txt 29.6 KB
Newer Older
1
2
3
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

4
include(CheckIncludeFile)
Brad King's avatar
Brad King committed
5
# Check if we can build support for ELF parsing.
6
7
8
9
10
if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
  CHECK_INCLUDE_FILES("stdint.h;elf_abi.h" HAVE_ELF_H)
else()
  CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H)
endif()
11
12
if(HAVE_ELF_H)
  set(CMAKE_USE_ELF_PARSER 1)
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
elseif(HAIKU)
  # On Haiku, we need to include elf32.h from the private headers
  set(CMake_HAIKU_INCLUDE_DIRS
    /boot/system/develop/headers/private/system
    /boot/system/develop/headers/private/system/arch/x86
    )

  set(CMAKE_REQUIRED_INCLUDES ${CMake_HAIKU_INCLUDE_DIRS})
  CHECK_INCLUDE_FILE("elf32.h" HAVE_ELF32_H)
  unset(CMAKE_REQUIRED_INCLUDES)

  if(HAVE_ELF32_H)
    set(CMAKE_USE_ELF_PARSER 1)
  else()
    unset(CMake_HAIKU_INCLUDE_DIRS)
    set(CMAKE_USE_ELF_PARSER)
  endif()
30
else()
31
  set(CMAKE_USE_ELF_PARSER)
32
endif()
Brad King's avatar
Brad King committed
33

34
35
36
37
if(APPLE)
  set(CMAKE_USE_MACH_PARSER 1)
endif()

38
set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR})
39

40
if(WIN32)
41
  # ensure Unicode friendly APIs are used on Windows
42
  add_definitions(-DUNICODE -D_UNICODE)
43
44
45

  # minimize windows.h content
  add_definitions(-DWIN32_LEAN_AND_MEAN)
46
47
endif()

48
49
50
51
52
53
54
55
56
# configure the .dox.in file
if(CMake_BUILD_DEVELOPER_REFERENCE)
  configure_file(
    "${CMake_SOURCE_DIR}/Source/dir.dox.in"
    "${CMake_BINARY_DIR}/Source/dir.dox"
    @ONLY
    )
endif()

57
# configure the .h file
58
configure_file(
59
60
61
  "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in"
  "${CMake_BINARY_DIR}/Source/cmConfigure.h"
  )
62
configure_file(
63
64
65
  "${CMake_SOURCE_DIR}/Source/cmVersionConfig.h.in"
  "${CMake_BINARY_DIR}/Source/cmVersionConfig.h"
  )
66
configure_file(
Andy Cedilnik's avatar
Andy Cedilnik committed
67
68
69
  "${CMake_SOURCE_DIR}/Source/CPack/cmCPackConfigure.h.in"
  "${CMake_BINARY_DIR}/Source/CPack/cmCPackConfigure.h"
  )
70

71
72
73
74
75
76
# Tell CMake executable in the build tree where to find the source tree.
configure_file(
  "${CMake_SOURCE_DIR}/Source/CMakeSourceDir.txt.in"
  "${CMake_BINARY_DIR}/CMakeFiles/CMakeSourceDir.txt" @ONLY
  )

Andy Cedilnik's avatar
Andy Cedilnik committed
77
# add the include path to find the .h
78
include_directories(
79
80
  "${CMake_BINARY_DIR}/Source"
  "${CMake_SOURCE_DIR}/Source"
81
  "${CMake_SOURCE_DIR}/Source/LexerParser"
82
83
  ${CMAKE_ZLIB_INCLUDES}
  ${CMAKE_EXPAT_INCLUDES}
84
  ${CMAKE_TAR_INCLUDES}
85
  ${CMAKE_COMPRESS_INCLUDES}
86
  ${CMake_HAIKU_INCLUDE_DIRS}
87
  )
88
89

# let cmake know it is supposed to use it
90
add_definitions(-DCMAKE_BUILD_WITH_CMAKE)
91

Brad King's avatar
Brad King committed
92
# Check if we can build the ELF parser.
93
94
if(CMAKE_USE_ELF_PARSER)
  set(ELF_SRCS cmELF.h cmELF.cxx)
95
endif()
Brad King's avatar
Brad King committed
96

97
98
99
100
101
# Check if we can build the Mach-O parser.
if(CMAKE_USE_MACH_PARSER)
  set(MACH_SRCS cmMachO.h cmMachO.cxx)
endif()

102
103
104
#
# Sources for CMakeLib
#
105
set(SRCS
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
  # Lexers/Parsers
  LexerParser/cmCommandArgumentLexer.cxx
  LexerParser/cmCommandArgumentLexer.h
  LexerParser/cmCommandArgumentLexer.in.l
  LexerParser/cmCommandArgumentParser.cxx
  LexerParser/cmCommandArgumentParserTokens.h
  LexerParser/cmCommandArgumentParser.y
  LexerParser/cmDependsJavaLexer.cxx
  LexerParser/cmDependsJavaLexer.h
  LexerParser/cmDependsJavaLexer.in.l
  LexerParser/cmDependsJavaParser.cxx
  LexerParser/cmDependsJavaParserTokens.h
  LexerParser/cmDependsJavaParser.y
  LexerParser/cmExprLexer.cxx
  LexerParser/cmExprLexer.h
  LexerParser/cmExprLexer.in.l
  LexerParser/cmExprParser.cxx
  LexerParser/cmExprParserTokens.h
  LexerParser/cmExprParser.y
  LexerParser/cmFortranLexer.cxx
  LexerParser/cmFortranLexer.h
  LexerParser/cmFortranLexer.in.l
  LexerParser/cmFortranParser.cxx
  LexerParser/cmFortranParserTokens.h
  LexerParser/cmFortranParser.y
  LexerParser/cmListFileLexer.c
  LexerParser/cmListFileLexer.in.l

134
  cmArchiveWrite.cxx
135
  cmBase32.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
136
137
  cmCacheManager.cxx
  cmCacheManager.h
138
139
  cmCLocaleEnvironmentScope.h
  cmCLocaleEnvironmentScope.cxx
140
  cmCommandArgumentParserHelper.cxx
141
142
  cmCommonTargetGenerator.cxx
  cmCommonTargetGenerator.h
143
144
  cmComputeComponentGraph.cxx
  cmComputeComponentGraph.h
145
146
  cmComputeLinkDepends.cxx
  cmComputeLinkDepends.h
147
148
  cmComputeLinkInformation.cxx
  cmComputeLinkInformation.h
149
150
  cmComputeTargetDepends.h
  cmComputeTargetDepends.cxx
151
152
  cmCPackPropertiesGenerator.h
  cmCPackPropertiesGenerator.cxx
153
154
  cmCryptoHash.cxx
  cmCryptoHash.h
155
156
  cmCurl.cxx
  cmCurl.h
Andy Cedilnik's avatar
Andy Cedilnik committed
157
158
  cmCustomCommand.cxx
  cmCustomCommand.h
159
160
  cmCustomCommandGenerator.cxx
  cmCustomCommandGenerator.h
161
162
  cmDefinitions.cxx
  cmDefinitions.h
Andy Cedilnik's avatar
Andy Cedilnik committed
163
164
165
166
167
168
  cmDepends.cxx
  cmDepends.h
  cmDependsC.cxx
  cmDependsC.h
  cmDependsFortran.cxx
  cmDependsFortran.h
169
170
  cmDependsJava.cxx
  cmDependsJava.h
Andy Cedilnik's avatar
Andy Cedilnik committed
171
172
  cmDependsJavaParserHelper.cxx
  cmDependsJavaParserHelper.h
Andy Cedilnik's avatar
Andy Cedilnik committed
173
  cmDocumentation.cxx
Alexander Neundorf's avatar
   
Alexander Neundorf committed
174
  cmDocumentationFormatter.cxx
175
  cmDocumentationSection.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
176
177
  cmDynamicLoader.cxx
  cmDynamicLoader.h
Brad King's avatar
Brad King committed
178
  ${ELF_SRCS}
179
  cmExprParserHelper.cxx
180
181
  cmExportBuildAndroidMKGenerator.h
  cmExportBuildAndroidMKGenerator.cxx
182
183
184
185
  cmExportBuildFileGenerator.h
  cmExportBuildFileGenerator.cxx
  cmExportFileGenerator.h
  cmExportFileGenerator.cxx
186
187
  cmExportInstallAndroidMKGenerator.h
  cmExportInstallAndroidMKGenerator.cxx
188
189
  cmExportInstallFileGenerator.h
  cmExportInstallFileGenerator.cxx
190
191
  cmExportTryCompileFileGenerator.h
  cmExportTryCompileFileGenerator.cxx
192
193
  cmExportSet.h
  cmExportSet.cxx
194
195
  cmExportSetMap.h
  cmExportSetMap.cxx
196
197
  cmExternalMakefileProjectGenerator.cxx
  cmExternalMakefileProjectGenerator.h
198
199
  cmExtraCodeBlocksGenerator.cxx
  cmExtraCodeBlocksGenerator.h
200
201
  cmExtraCodeLiteGenerator.cxx
  cmExtraCodeLiteGenerator.h
Alexander Neundorf's avatar
   
Alexander Neundorf committed
202
203
  cmExtraEclipseCDT4Generator.cxx
  cmExtraEclipseCDT4Generator.h
204
205
  cmExtraKateGenerator.cxx
  cmExtraKateGenerator.h
206
207
  cmExtraSublimeTextGenerator.cxx
  cmExtraSublimeTextGenerator.h
208
209
210
211
212
213
  cmFileLock.cxx
  cmFileLock.h
  cmFileLockPool.cxx
  cmFileLockPool.h
  cmFileLockResult.cxx
  cmFileLockResult.h
214
215
  cmFilePathChecksum.cxx
  cmFilePathChecksum.h
216
217
  cmFileTimeComparison.cxx
  cmFileTimeComparison.h
218
  cmFortranParserImpl.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
219
  cmGeneratedFileStream.cxx
220
221
  cmGeneratorExpressionContext.cxx
  cmGeneratorExpressionContext.h
222
223
  cmGeneratorExpressionDAGChecker.cxx
  cmGeneratorExpressionDAGChecker.h
224
225
  cmGeneratorExpressionEvaluationFile.cxx
  cmGeneratorExpressionEvaluationFile.h
226
227
228
229
  cmGeneratorExpressionEvaluator.cxx
  cmGeneratorExpressionEvaluator.h
  cmGeneratorExpressionLexer.cxx
  cmGeneratorExpressionLexer.h
230
231
  cmGeneratorExpressionNode.cxx
  cmGeneratorExpressionNode.h
232
233
  cmGeneratorExpressionParser.cxx
  cmGeneratorExpressionParser.h
234
235
  cmGeneratorExpression.cxx
  cmGeneratorExpression.h
236
237
  cmGeneratorTarget.cxx
  cmGeneratorTarget.h
238
239
  cmGlobalCommonGenerator.cxx
  cmGlobalCommonGenerator.h
Andy Cedilnik's avatar
Andy Cedilnik committed
240
241
  cmGlobalGenerator.cxx
  cmGlobalGenerator.h
242
  cmGlobalGeneratorFactory.h
Ken Martin's avatar
Ken Martin committed
243
244
  cmGlobalUnixMakefileGenerator3.cxx
  cmGlobalUnixMakefileGenerator3.h
245
  cmGraphAdjacencyList.h
246
247
  cmGraphVizWriter.cxx
  cmGraphVizWriter.h
248
249
  cmInstallGenerator.h
  cmInstallGenerator.cxx
Alexander Neundorf's avatar
   
Alexander Neundorf committed
250
  cmInstallExportGenerator.cxx
251
252
  cmInstalledFile.h
  cmInstalledFile.cxx
253
254
  cmInstallFilesGenerator.h
  cmInstallFilesGenerator.cxx
255
256
257
258
  cmInstallScriptGenerator.h
  cmInstallScriptGenerator.cxx
  cmInstallTargetGenerator.h
  cmInstallTargetGenerator.cxx
259
260
  cmInstallDirectoryGenerator.h
  cmInstallDirectoryGenerator.cxx
261
  cmLinkedTree.h
262
  cmLinkItem.h
263
264
  cmLinkLineComputer.cxx
  cmLinkLineComputer.h
265
266
  cmLinkLineDeviceComputer.cxx
  cmLinkLineDeviceComputer.h
Andy Cedilnik's avatar
Andy Cedilnik committed
267
268
  cmListFileCache.cxx
  cmListFileCache.h
269
270
  cmLocalCommonGenerator.cxx
  cmLocalCommonGenerator.h
Andy Cedilnik's avatar
Andy Cedilnik committed
271
272
  cmLocalGenerator.cxx
  cmLocalGenerator.h
273
274
  cmRulePlaceholderExpander.cxx
  cmRulePlaceholderExpander.h
Ken Martin's avatar
Ken Martin committed
275
  cmLocalUnixMakefileGenerator3.cxx
276
  cmLocale.h
277
  ${MACH_SRCS}
Andy Cedilnik's avatar
Andy Cedilnik committed
278
279
  cmMakefile.cxx
  cmMakefile.h
280
281
282
283
  cmMakefileTargetGenerator.cxx
  cmMakefileExecutableTargetGenerator.cxx
  cmMakefileLibraryTargetGenerator.cxx
  cmMakefileUtilityTargetGenerator.cxx
284
285
  cmMessenger.cxx
  cmMessenger.h
286
287
  cmMSVC60LinkLineComputer.cxx
  cmMSVC60LinkLineComputer.h
288
289
  cmOSXBundleGenerator.cxx
  cmOSXBundleGenerator.h
290
291
  cmOutputConverter.cxx
  cmOutputConverter.h
292
293
  cmNewLineStyle.h
  cmNewLineStyle.cxx
294
295
  cmOrderDirectories.cxx
  cmOrderDirectories.h
296
297
  cmPolicies.h
  cmPolicies.cxx
298
299
  cmProcessOutput.cxx
  cmProcessOutput.h
300
301
  cmProcessTools.cxx
  cmProcessTools.h
302
303
304
305
  cmProperty.cxx
  cmProperty.h
  cmPropertyDefinition.cxx
  cmPropertyDefinition.h
306
307
308
309
  cmPropertyDefinitionMap.cxx
  cmPropertyDefinitionMap.h
  cmPropertyMap.cxx
  cmPropertyMap.h
310
311
312
  cmQtAutoGen.cxx
  cmQtAutoGen.h
  cmQtAutoGenDigest.h
313
314
  cmQtAutoGeneratorInitializer.cxx
  cmQtAutoGeneratorInitializer.h
315
316
  cmQtAutoGenerators.cxx
  cmQtAutoGenerators.h
317
318
  cmRST.cxx
  cmRST.h
319
320
  cmScriptGenerator.h
  cmScriptGenerator.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
321
322
  cmSourceFile.cxx
  cmSourceFile.h
323
324
  cmSourceFileLocation.cxx
  cmSourceFileLocation.h
Andy Cedilnik's avatar
Andy Cedilnik committed
325
326
  cmSourceGroup.cxx
  cmSourceGroup.h
Stephen Kelly's avatar
Stephen Kelly committed
327
328
  cmState.cxx
  cmState.h
329
330
331
332
  cmStateDirectory.cxx
  cmStateDirectory.h
  cmStateSnapshot.cxx
  cmStateSnapshot.h
333
  cmStateTypes.h
Andy Cedilnik's avatar
Andy Cedilnik committed
334
335
336
337
  cmSystemTools.cxx
  cmSystemTools.h
  cmTarget.cxx
  cmTarget.h
338
339
  cmTargetPropertyComputer.cxx
  cmTargetPropertyComputer.h
340
  cmTargetExport.h
341
342
  cmTest.cxx
  cmTest.h
343
344
  cmTestGenerator.cxx
  cmTestGenerator.h
345
  cmUuid.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
346
347
348
349
  cmVariableWatch.cxx
  cmVariableWatch.h
  cmVersion.cxx
  cmVersion.h
350
351
  cmWorkingDirectory.cxx
  cmWorkingDirectory.h
Andy Cedilnik's avatar
Andy Cedilnik committed
352
353
  cmXMLParser.cxx
  cmXMLParser.h
354
355
  cmXMLSafe.cxx
  cmXMLSafe.h
356
357
  cmXMLWriter.cxx
  cmXMLWriter.h
Andy Cedilnik's avatar
Andy Cedilnik committed
358
359
  cmake.cxx
  cmake.h
360

361
362
  cmCommand.cxx
  cmCommand.h
363
364
365
366
  cmCommands.cxx
  cmCommands.h
  cmAddCompileOptionsCommand.cxx
  cmAddCompileOptionsCommand.h
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
  cmAddCustomCommandCommand.cxx
  cmAddCustomCommandCommand.h
  cmAddCustomTargetCommand.cxx
  cmAddCustomTargetCommand.h
  cmAddDefinitionsCommand.cxx
  cmAddDefinitionsCommand.h
  cmAddDependenciesCommand.cxx
  cmAddDependenciesCommand.h
  cmAddExecutableCommand.cxx
  cmAddExecutableCommand.h
  cmAddLibraryCommand.cxx
  cmAddLibraryCommand.h
  cmAddSubDirectoryCommand.cxx
  cmAddSubDirectoryCommand.h
  cmAddTestCommand.cxx
  cmAddTestCommand.h
383
384
  cmAuxSourceDirectoryCommand.cxx
  cmAuxSourceDirectoryCommand.h
385
386
387
388
  cmBreakCommand.cxx
  cmBreakCommand.h
  cmBuildCommand.cxx
  cmBuildCommand.h
389
390
391
392
  cmBuildNameCommand.cxx
  cmBuildNameCommand.h
  cmCMakeHostSystemInformationCommand.cxx
  cmCMakeHostSystemInformationCommand.h
393
394
395
396
397
398
  cmCMakeMinimumRequired.cxx
  cmCMakeMinimumRequired.h
  cmCMakePolicyCommand.cxx
  cmCMakePolicyCommand.h
  cmCommandArgumentsHelper.cxx
  cmCommandArgumentsHelper.h
399
400
  cmConditionEvaluator.cxx
  cmConditionEvaluator.h
401
402
403
404
405
406
407
408
409
410
  cmConfigureFileCommand.cxx
  cmConfigureFileCommand.h
  cmContinueCommand.cxx
  cmContinueCommand.h
  cmCoreTryCompile.cxx
  cmCoreTryCompile.h
  cmCreateTestSourceList.cxx
  cmCreateTestSourceList.h
  cmDefinePropertyCommand.cxx
  cmDefinePropertyCommand.h
411
412
  cmDisallowedCommand.cxx
  cmDisallowedCommand.h
413
414
415
416
417
418
419
420
  cmEnableLanguageCommand.cxx
  cmEnableLanguageCommand.h
  cmEnableTestingCommand.cxx
  cmEnableTestingCommand.h
  cmExecProgramCommand.cxx
  cmExecProgramCommand.h
  cmExecuteProcessCommand.cxx
  cmExecuteProcessCommand.h
421
422
  cmExpandedCommandArgument.cxx
  cmExpandedCommandArgument.h
423
424
425
426
427
428
  cmExportCommand.cxx
  cmExportCommand.h
  cmExportLibraryDependenciesCommand.cxx
  cmExportLibraryDependenciesCommand.h
  cmFLTKWrapUICommand.cxx
  cmFLTKWrapUICommand.h
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
  cmFileCommand.cxx
  cmFileCommand.h
  cmFindBase.cxx
  cmFindBase.h
  cmFindCommon.cxx
  cmFindCommon.h
  cmFindFileCommand.cxx
  cmFindFileCommand.h
  cmFindLibraryCommand.cxx
  cmFindLibraryCommand.h
  cmFindPackageCommand.cxx
  cmFindPackageCommand.h
  cmFindPathCommand.cxx
  cmFindPathCommand.h
  cmFindProgramCommand.cxx
  cmFindProgramCommand.h
  cmForEachCommand.cxx
  cmForEachCommand.h
  cmFunctionCommand.cxx
  cmFunctionCommand.h
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
  cmGetCMakePropertyCommand.cxx
  cmGetCMakePropertyCommand.h
  cmGetDirectoryPropertyCommand.cxx
  cmGetDirectoryPropertyCommand.h
  cmGetFilenameComponentCommand.cxx
  cmGetFilenameComponentCommand.h
  cmGetPropertyCommand.cxx
  cmGetPropertyCommand.h
  cmGetSourceFilePropertyCommand.cxx
  cmGetSourceFilePropertyCommand.h
  cmGetTargetPropertyCommand.cxx
  cmGetTargetPropertyCommand.h
  cmGetTestPropertyCommand.cxx
  cmGetTestPropertyCommand.h
  cmHexFileConverter.cxx
  cmHexFileConverter.h
  cmIfCommand.cxx
  cmIfCommand.h
  cmIncludeCommand.cxx
  cmIncludeCommand.h
  cmIncludeDirectoryCommand.cxx
  cmIncludeDirectoryCommand.h
471
472
  cmIncludeExternalMSProjectCommand.cxx
  cmIncludeExternalMSProjectCommand.h
473
474
  cmIncludeGuardCommand.cxx
  cmIncludeGuardCommand.h
475
476
477
478
479
480
481
482
  cmIncludeRegularExpressionCommand.cxx
  cmIncludeRegularExpressionCommand.h
  cmInstallCommand.cxx
  cmInstallCommand.h
  cmInstallCommandArguments.cxx
  cmInstallCommandArguments.h
  cmInstallFilesCommand.cxx
  cmInstallFilesCommand.h
483
484
  cmInstallProgramsCommand.cxx
  cmInstallProgramsCommand.h
485
486
487
488
  cmInstallTargetsCommand.cxx
  cmInstallTargetsCommand.h
  cmLinkDirectoriesCommand.cxx
  cmLinkDirectoriesCommand.h
489
490
  cmLinkLibrariesCommand.cxx
  cmLinkLibrariesCommand.h
491
492
  cmListCommand.cxx
  cmListCommand.h
493
494
495
496
  cmLoadCacheCommand.cxx
  cmLoadCacheCommand.h
  cmLoadCommandCommand.cxx
  cmLoadCommandCommand.h
497
498
499
500
501
502
503
504
505
506
507
508
  cmMacroCommand.cxx
  cmMacroCommand.h
  cmMakeDirectoryCommand.cxx
  cmMakeDirectoryCommand.h
  cmMarkAsAdvancedCommand.cxx
  cmMarkAsAdvancedCommand.h
  cmMathCommand.cxx
  cmMathCommand.h
  cmMessageCommand.cxx
  cmMessageCommand.h
  cmOptionCommand.cxx
  cmOptionCommand.h
509
510
  cmOutputRequiredFilesCommand.cxx
  cmOutputRequiredFilesCommand.h
511
512
513
514
  cmParseArgumentsCommand.cxx
  cmParseArgumentsCommand.h
  cmPathLabel.cxx
  cmPathLabel.h
515
516
  cmProjectCommand.cxx
  cmProjectCommand.h
517
518
519
520
521
522
523
524
  cmQTWrapCPPCommand.cxx
  cmQTWrapCPPCommand.h
  cmQTWrapUICommand.cxx
  cmQTWrapUICommand.h
  cmRemoveCommand.cxx
  cmRemoveCommand.h
  cmRemoveDefinitionsCommand.cxx
  cmRemoveDefinitionsCommand.h
525
526
  cmReturnCommand.cxx
  cmReturnCommand.h
527
528
  cmSearchPath.cxx
  cmSearchPath.h
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
  cmSeparateArgumentsCommand.cxx
  cmSeparateArgumentsCommand.h
  cmSetCommand.cxx
  cmSetCommand.h
  cmSetDirectoryPropertiesCommand.cxx
  cmSetDirectoryPropertiesCommand.h
  cmSetPropertyCommand.cxx
  cmSetPropertyCommand.h
  cmSetSourceFilesPropertiesCommand.cxx
  cmSetSourceFilesPropertiesCommand.h
  cmSetTargetPropertiesCommand.cxx
  cmSetTargetPropertiesCommand.h
  cmSetTestsPropertiesCommand.cxx
  cmSetTestsPropertiesCommand.h
  cmSiteNameCommand.cxx
  cmSiteNameCommand.h
545
546
  cmSourceGroupCommand.cxx
  cmSourceGroupCommand.h
547
548
549
550
  cmStringCommand.cxx
  cmStringCommand.h
  cmSubdirCommand.cxx
  cmSubdirCommand.h
551
552
553
554
555
556
557
558
559
560
  cmSubdirDependsCommand.cxx
  cmSubdirDependsCommand.h
  cmTargetCompileDefinitionsCommand.cxx
  cmTargetCompileDefinitionsCommand.h
  cmTargetCompileFeaturesCommand.cxx
  cmTargetCompileFeaturesCommand.h
  cmTargetCompileOptionsCommand.cxx
  cmTargetCompileOptionsCommand.h
  cmTargetIncludeDirectoriesCommand.cxx
  cmTargetIncludeDirectoriesCommand.h
561
562
  cmTargetLinkLibrariesCommand.cxx
  cmTargetLinkLibrariesCommand.h
563
564
565
566
  cmTargetPropCommandBase.cxx
  cmTargetPropCommandBase.h
  cmTargetSourcesCommand.cxx
  cmTargetSourcesCommand.h
567
568
569
570
571
572
  cmTimestamp.cxx
  cmTimestamp.h
  cmTryCompileCommand.cxx
  cmTryCompileCommand.h
  cmTryRunCommand.cxx
  cmTryRunCommand.h
573
574
  cmUnexpectedCommand.cxx
  cmUnexpectedCommand.h
575
576
  cmUnsetCommand.cxx
  cmUnsetCommand.h
577
578
579
580
581
582
583
584
  cmUseMangledMesaCommand.cxx
  cmUseMangledMesaCommand.h
  cmUtilitySourceCommand.cxx
  cmUtilitySourceCommand.h
  cmVariableRequiresCommand.cxx
  cmVariableRequiresCommand.h
  cmVariableWatchCommand.cxx
  cmVariableWatchCommand.h
585
586
  cmWhileCommand.cxx
  cmWhileCommand.h
587
588
  cmWriteFileCommand.cxx
  cmWriteFileCommand.h
589

590
591
  cm_get_date.h
  cm_get_date.c
592
593
  cm_utf8.h
  cm_utf8.c
594
595
  cm_codecvt.hxx
  cm_codecvt.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
596
  )
Ken Martin's avatar
Ken Martin committed
597

598
599
600
SET_PROPERTY(SOURCE cmProcessOutput.cxx APPEND PROPERTY COMPILE_DEFINITIONS
  KWSYS_ENCODING_DEFAULT_CODEPAGE=${KWSYS_ENCODING_DEFAULT_CODEPAGE})

601
# Kdevelop only works on UNIX and not windows
602
603
if(UNIX)
  set(SRCS ${SRCS} cmGlobalKdevelopGenerator.cxx)
604
endif()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
605

606
# Xcode only works on Apple
607
608
if(APPLE)
  set(SRCS ${SRCS}
609
    cmXCodeObject.cxx
610
    cmXCode21Object.cxx
611
    cmXCodeScheme.cxx
612
    cmGlobalXCodeGenerator.cxx
613
    cmGlobalXCodeGenerator.h
614
615
    cmLocalXCodeGenerator.cxx
    cmLocalXCodeGenerator.h)
616
endif()
617
618


619
620
if (WIN32)
  set(SRCS ${SRCS}
621
622
    cmCallVisualStudioMacro.cxx
    cmCallVisualStudioMacro.h
623
    bindexplib.cxx
624
625
    )

626
627
  if(NOT UNIX)
    set(SRCS ${SRCS}
628
      cmGlobalBorlandMakefileGenerator.cxx
629
      cmGlobalBorlandMakefileGenerator.h
630
631
      cmGlobalMSYSMakefileGenerator.cxx
      cmGlobalMinGWMakefileGenerator.cxx
632
      cmGlobalNMakeMakefileGenerator.cxx
633
      cmGlobalNMakeMakefileGenerator.h
634
635
      cmGlobalJOMMakefileGenerator.cxx
      cmGlobalJOMMakefileGenerator.h
636
637
638
639
640
641
      cmGlobalVisualStudio71Generator.cxx
      cmGlobalVisualStudio71Generator.h
      cmGlobalVisualStudio7Generator.cxx
      cmGlobalVisualStudio7Generator.h
      cmGlobalVisualStudio8Generator.cxx
      cmGlobalVisualStudio8Generator.h
642
643
      cmGlobalVisualStudio9Generator.cxx
      cmGlobalVisualStudio9Generator.h
644
645
646
647
      cmVisualStudioGeneratorOptions.h
      cmVisualStudioGeneratorOptions.cxx
      cmVisualStudio10TargetGenerator.h
      cmVisualStudio10TargetGenerator.cxx
648
649
      cmVisualStudio10ToolsetOptions.h
      cmVisualStudio10ToolsetOptions.cxx
650
651
652
653
      cmLocalVisualStudio10Generator.cxx
      cmLocalVisualStudio10Generator.h
      cmGlobalVisualStudio10Generator.h
      cmGlobalVisualStudio10Generator.cxx
654
655
      cmGlobalVisualStudio11Generator.h
      cmGlobalVisualStudio11Generator.cxx
656
657
      cmGlobalVisualStudio12Generator.h
      cmGlobalVisualStudio12Generator.cxx
658
659
      cmGlobalVisualStudio14Generator.h
      cmGlobalVisualStudio14Generator.cxx
660
661
      cmGlobalVisualStudio15Generator.h
      cmGlobalVisualStudio15Generator.cxx
662
663
      cmGlobalVisualStudioGenerator.cxx
      cmGlobalVisualStudioGenerator.h
Brad King's avatar
Brad King committed
664
      cmIDEFlagTable.h
665
666
      cmIDEOptions.cxx
      cmIDEOptions.h
667
668
      cmLocalVisualStudio7Generator.cxx
      cmLocalVisualStudio7Generator.h
669
670
      cmLocalVisualStudioGenerator.cxx
      cmLocalVisualStudioGenerator.h
671
672
673
674
      cmVisualStudioSlnData.h
      cmVisualStudioSlnData.cxx
      cmVisualStudioSlnParser.h
      cmVisualStudioSlnParser.cxx
675
676
      cmVisualStudioWCEPlatformParser.h
      cmVisualStudioWCEPlatformParser.cxx
677
678
679
680
681
682
683
684
      cmGlobalGhsMultiGenerator.cxx
      cmGlobalGhsMultiGenerator.h
      cmLocalGhsMultiGenerator.cxx
      cmLocalGhsMultiGenerator.h
      cmGhsMultiTargetGenerator.cxx
      cmGhsMultiTargetGenerator.h
      cmGhsMultiGpj.cxx
      cmGhsMultiGpj.h
685
686
      cmVSSetupHelper.cxx
      cmVSSetupHelper.h
687
      )
688
689
690
691

    # Add a manifest file to executables on Windows to allow for
    # GetVersion to work properly on Windows 8 and above.
    set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake.version.manifest)
692
693
  endif()
endif ()
Ken Martin's avatar
Ken Martin committed
694

695
# Watcom support
696
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
697
698
699
700
701
702
703
  set_property(SOURCE cmake.cxx APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_USE_WMAKE)
  list(APPEND SRCS
    cmGlobalWatcomWMakeGenerator.cxx
    cmGlobalWatcomWMakeGenerator.h
    )
endif()

704
# Ninja support
705
set(SRCS ${SRCS}
706
707
708
709
710
711
712
713
714
715
716
  cmGlobalNinjaGenerator.cxx
  cmGlobalNinjaGenerator.h
  cmNinjaTypes.h
  cmLocalNinjaGenerator.cxx
  cmLocalNinjaGenerator.h
  cmNinjaTargetGenerator.cxx
  cmNinjaTargetGenerator.h
  cmNinjaNormalTargetGenerator.cxx
  cmNinjaNormalTargetGenerator.h
  cmNinjaUtilityTargetGenerator.cxx
  cmNinjaUtilityTargetGenerator.h
717
718
  cmNinjaLinkLineComputer.cxx
  cmNinjaLinkLineComputer.h
719
  )
720

721
722
723
# Temporary variable for tools targets
set(_tools)

Stephen Kelly's avatar
Stephen Kelly committed
724
if(WIN32 AND NOT CYGWIN)
725
  set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
726
  add_executable(cmcldeps cmcldeps.cxx ${MANIFEST_FILE})
727
  list(APPEND _tools cmcldeps)
728
729
  target_link_libraries(cmcldeps CMakeLib)
endif()
730

731
732
733
734
735
736
foreach(v CURL_CA_BUNDLE CURL_CA_PATH)
  if(${v})
    set_property(SOURCE cmCurl.cxx APPEND PROPERTY COMPILE_DEFINITIONS ${v}="${${v}}")
  endif()
endforeach()

737
738
foreach(check
    STAT_HAS_ST_MTIM
739
    STAT_HAS_ST_MTIMESPEC
740
741
742
743
744
745
746
747
748
749
    )
  if(KWSYS_CXX_${check}_COMPILED) # abuse KWSys check cache entry
    set(CMake_${check} 1)
  else()
    set(CMake_${check} 0)
  endif()
  set_property(SOURCE cmFileTimeComparison.cxx APPEND PROPERTY
    COMPILE_DEFINITIONS CMake_${check}=${CMake_${check}})
endforeach()

750
# create a library used by the command line and the GUI
751
752
add_library(CMakeLib ${SRCS})
target_link_libraries(CMakeLib cmsys
753
  ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES}
754
  ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES}
755
  ${CMAKE_CURL_LIBRARIES}
756
  ${CMAKE_JSONCPP_LIBRARIES}
757
  ${CMAKE_LIBUV_LIBRARIES}
758
  ${CMAKE_LIBRHASH_LIBRARIES}
759
  ${CMake_KWIML_LIBRARIES}
760
  )
761

762
763
764
765
766
767
768
769
770
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
  # the atomic instructions are implemented using libatomic on some platforms,
  # so linking to that may be required
  check_library_exists(atomic __atomic_fetch_add_4 "" LIBATOMIC_NEEDED)
  if(LIBATOMIC_NEEDED)
    target_link_libraries(CMakeLib atomic)
  endif()
endif()

771
# On Apple we need CoreFoundation
772
773
if(APPLE)
  target_link_libraries(CMakeLib "-framework CoreFoundation")
774
endif()
775

776
777
if(WIN32 AND NOT UNIX)
  # We need the rpcrt4 library on Windows.
778
779
  # We need the crypt32 library on Windows for crypto/cert APIs.
  target_link_libraries(CMakeLib rpcrt4 crypt32)
780
endif()
781

782
783
target_compile_definitions(CMakeLib PUBLIC ${CLANG_TIDY_DEFINITIONS})

784
785
786
#
# CTestLib
#
787
include_directories(
788
  "${CMake_SOURCE_DIR}/Source/CTest"
789
  ${CMAKE_XMLRPC_INCLUDES}
Andy Cedilnik's avatar
Andy Cedilnik committed
790
  ${CMAKE_CURL_INCLUDES}
791
  )
792
793
794
#
# Sources for CTestLib
#
795
set(CTEST_SRCS cmCTest.cxx
796
  CTest/cmProcess.cxx
797
  CTest/cmCTestBatchTestHandler.cxx
798
  CTest/cmCTestBuildAndTestHandler.cxx
799
  CTest/cmCTestBuildCommand.cxx
Ken Martin's avatar
Ken Martin committed
800
  CTest/cmCTestBuildHandler.cxx
801
  CTest/cmCTestConfigureCommand.cxx
Ken Martin's avatar
Ken Martin committed
802
  CTest/cmCTestConfigureHandler.cxx
803
  CTest/cmCTestCoverageCommand.cxx
Ken Martin's avatar
Ken Martin committed
804
  CTest/cmCTestCoverageHandler.cxx
805
  CTest/cmCTestCurl.cxx
806
  CTest/cmParseMumpsCoverage.cxx
Bill Hoffman's avatar
Bill Hoffman committed
807
  CTest/cmParseCacheCoverage.cxx
808
  CTest/cmParseGTMCoverage.cxx
809
  CTest/cmParseJacocoCoverage.cxx
810
  CTest/cmParseBlanketJSCoverage.cxx
Bill Hoffman's avatar
Bill Hoffman committed
811
  CTest/cmParsePHPCoverage.cxx
812
  CTest/cmParseCoberturaCoverage.cxx
813
  CTest/cmParseDelphiCoverage.cxx
814
  CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
815
  CTest/cmCTestGenericHandler.cxx
816
  CTest/cmCTestHandlerCommand.cxx
817
  CTest/cmCTestLaunch.cxx
818
  CTest/cmCTestMemCheckCommand.cxx
819
  CTest/cmCTestMemCheckHandler.cxx
820
  CTest/cmCTestMultiProcessHandler.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
821
  CTest/cmCTestReadCustomFilesCommand.cxx
822
  CTest/cmCTestRunScriptCommand.cxx
823
  CTest/cmCTestRunTest.cxx
824
  CTest/cmCTestScriptHandler.cxx
825
  CTest/cmCTestSleepCommand.cxx
826
  CTest/cmCTestStartCommand.cxx
827
828
829
  CTest/cmCTestSubmitCommand.cxx
  CTest/cmCTestSubmitHandler.cxx
  CTest/cmCTestTestCommand.cxx
830
831
832
  CTest/cmCTestTestHandler.cxx
  CTest/cmCTestUpdateCommand.cxx
  CTest/cmCTestUpdateHandler.cxx
Zach's avatar
Zach committed
833
834
  CTest/cmCTestUploadCommand.cxx
  CTest/cmCTestUploadHandler.cxx
835
836
837

  CTest/cmCTestVC.cxx
  CTest/cmCTestVC.h
838
839
  CTest/cmCTestGlobalVC.cxx
  CTest/cmCTestGlobalVC.h
Brad King's avatar
Brad King committed
840
841
842
843
  CTest/cmCTestCVS.cxx
  CTest/cmCTestCVS.h
  CTest/cmCTestSVN.cxx
  CTest/cmCTestSVN.h
844
845
  CTest/cmCTestBZR.cxx
  CTest/cmCTestBZR.h
846
847
  CTest/cmCTestGIT.cxx
  CTest/cmCTestGIT.h
848
849
  CTest/cmCTestHG.cxx
  CTest/cmCTestHG.h
850
851
  CTest/cmCTestP4.cxx
  CTest/cmCTestP4.h
Andy Cedilnik's avatar
Andy Cedilnik committed
852
  )
Ken Martin's avatar
oops    
Ken Martin committed
853

854
# Build CTestLib
855
856
add_library(CTestLib ${CTEST_SRCS})
target_link_libraries(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_LIBRARIES})
857

858
859
860
861
862
863
#
# CPack
#
include_directories(
  "${CMake_SOURCE_DIR}/Source/CPack"
  )
Andy Cedilnik's avatar
Andy Cedilnik committed
864
865
866
#
# Sources for CPack
#
867
set(CPACK_SRCS
868
  CPack/cmCPackArchiveGenerator.cxx
869
  CPack/cmCPackComponentGroup.cxx
Bill Hoffman's avatar
Bill Hoffman committed
870
  CPack/cmCPackGeneratorFactory.cxx
Bill Hoffman's avatar
Bill Hoffman committed
871
  CPack/cmCPackGenerator.cxx
872
  CPack/cmCPackLog.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
873
  CPack/cmCPackNSISGenerator.cxx
874
875
  CPack/cmCPackSTGZGenerator.cxx
  CPack/cmCPackTGZGenerator.cxx
876
  CPack/cmCPackTXZGenerator.cxx
877
  CPack/cmCPackTarBZip2Generator.cxx
878
  CPack/cmCPackTarCompressGenerator.cxx
879
  CPack/cmCPackZIPGenerator.cxx
880
  CPack/cmCPack7zGenerator.cxx
881
  CPack/cmCPackDebGenerator.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
882
  )
883
884
885
886
887
888
889
890
891
892
893
894
895
# CPack IFW generator
set(CPACK_SRCS ${CPACK_SRCS}
  CPack/IFW/cmCPackIFWCommon.cxx
  CPack/IFW/cmCPackIFWCommon.h
  CPack/IFW/cmCPackIFWGenerator.cxx
  CPack/IFW/cmCPackIFWGenerator.h
  CPack/IFW/cmCPackIFWInstaller.cxx
  CPack/IFW/cmCPackIFWInstaller.h
  CPack/IFW/cmCPackIFWPackage.cxx
  CPack/IFW/cmCPackIFWPackage.h
  CPack/IFW/cmCPackIFWRepository.cxx
  CPack/IFW/cmCPackIFWRepository.h
  )
Alexander Neundorf's avatar
   
Alexander Neundorf committed
896

897
898
if(CYGWIN)
  set(CPACK_SRCS ${CPACK_SRCS}
Alexander Neundorf's avatar
   
Alexander Neundorf committed
899
900
901
    CPack/cmCPackCygwinBinaryGenerator.cxx
    CPack/cmCPackCygwinSourceGenerator.cxx
    )
902
endif()
903

904
905
option(CPACK_ENABLE_FREEBSD_PKG "Add FreeBSD pkg(8) generator to CPack." OFF)

906
907
if(UNIX)
  set(CPACK_SRCS ${CPACK_SRCS}
Alexander Neundorf's avatar
   
Alexander Neundorf committed
908
909
    CPack/cmCPackRPMGenerator.cxx
    )
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936

  # Optionally, try to use pkg(8)
  if(CPACK_ENABLE_FREEBSD_PKG)
    # On UNIX, you may find FreeBSD's pkg(8) and attendant
    # library -- it can be used on FreeBSD, Dragonfly, NetBSD,
    # OpenBSD and also Linux and OSX. Look for the header and
    # the library; it's a warning on FreeBSD if they're not
    # found, and informational on other platforms.
    find_path(FREEBSD_PKG_INCLUDE_DIRS "pkg.h" PATHS /usr/local)
    if(FREEBSD_PKG_INCLUDE_DIRS)
      find_library(FREEBSD_PKG_LIBRARIES
        pkg
        DOC "FreeBSD pkg(8) library")
      if(FREEBSD_PKG_LIBRARIES)
        set(CPACK_SRCS ${CPACK_SRCS}
          CPack/cmCPackFreeBSDGenerator.cxx
          )
      endif()
    endif()

    if (NOT FREEBSD_PKG_INCLUDE_DIRS OR NOT FREEBSD_PKG_LIBRARIES)
      message(FATAL_ERROR "CPack needs libpkg(3) to produce FreeBSD packages natively.")
    endif()
  else()
    set(FREEBSD_PKG_INCLUDE_DIRS NOTFOUND)
    set(FREEBSD_PKG_LIBRARIES NOTFOUND)
  endif()
937
endif()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
938

939
940
941
942
if(CYGWIN)
  find_package(LibUUID)
endif()
if(WIN32 OR (CYGWIN AND LibUUID_FOUND))
943
  set(CPACK_SRCS ${CPACK_SRCS}
944
945
    CPack/Wix/cmCMakeToWixPath.cxx
    CPack/Wix/cmCMakeToWixPath.h
946
    CPack/WiX/cmCPackWIXGenerator.cxx
947
    CPack/WiX/cmCPackWIXGenerator.h
948
    CPack/WiX/cmWIXAccessControlList.cxx
949
    CPack/WiX/cmWIXAccessControlList.h
Nils Gladitz's avatar
Nils Gladitz committed
950
    CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
951
    CPack/WiX/cmWIXDirectoriesSourceWriter.h
Nils Gladitz's avatar
Nils Gladitz committed
952
    CPack/WiX/cmWIXFeaturesSourceWriter.cxx
953
    CPack/WiX/cmWIXFeaturesSourceWriter.h
Nils Gladitz's avatar
Nils Gladitz committed
954
    CPack/WiX/cmWIXFilesSourceWriter.cxx
955
    CPack/WiX/cmWIXFilesSourceWriter.h
Nils Gladitz's avatar
Nils Gladitz committed
956
    CPack/WiX/cmWIXPatch.cxx
957
    CPack/WiX/cmWIXPatch.h
958
    CPack/WiX/cmWIXPatchParser.cxx
959
    CPack/WiX/cmWIXPatchParser.h
960
    CPack/WiX/cmWIXRichTextFormatWriter.cxx
961
    CPack/WiX/cmWIXRichTextFormatWriter.h
962
    CPack/WiX/cmWIXShortcut.cxx
963
    CPack/WiX/cmWIXShortcut.h
964
    CPack/WiX/cmWIXSourceWriter.cxx
965
    CPack/WiX/cmWIXSourceWriter.h
966
    )
967
968
endif()

969
970
if(APPLE)
  set(CPACK_SRCS ${CPACK_SRCS}
971
    CPack/cmCPackBundleGenerator.cxx
972
    CPack/cmCPackDragNDropGenerator.cxx
Alexander Neundorf's avatar
   
Alexander Neundorf committed
973
    CPack/cmCPackOSXX11Generator.cxx
974
    CPack/cmCPackPKGGenerator.cxx
Alexander Neundorf's avatar
   
Alexander Neundorf committed
975
    CPack/cmCPackPackageMakerGenerator.cxx
976
    CPack/cmCPackProductBuildGenerator.cxx
Alexander Neundorf's avatar
   
Alexander Neundorf committed
977
    )
978
endif()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
979

Andy Cedilnik's avatar
Andy Cedilnik committed
980
# Build CPackLib
981
982
add_library(CPackLib ${CPACK_SRCS})
target_link_libraries(CPackLib CMakeLib)
983
if(APPLE)
984
985
986
987
988
989
990
991
992
993
994
995
996
997
  # Some compilers produce errors in the CoreServices framework headers.
  # Ideally such errors should be fixed by either the compiler vendor
  # or the framework source, but we try to workaround it and build anyway.
  # If it does not work, build with reduced functionality and warn.
  check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices)
  if(HAVE_CoreServices)
    set_property(SOURCE CPack/cmCPackDragNDropGenerator.cxx PROPERTY COMPILE_DEFINITIONS HAVE_CoreServices)
    target_link_libraries(CPackLib "-framework CoreServices")
  else()
    message(WARNING "This compiler does not appear to support\n"
      "  #include <CoreServices/CoreServices.h>\n"
      "Some CPack functionality may be limited.\n"
      "See CMakeFiles/CMakeError.log for details of the failure.")
  endif()
998
endif()
999
1000
1001
1002
1003
if(CYGWIN AND LibUUID_FOUND)
  target_link_libraries(CPackLib ${LibUUID_LIBRARIES})
  include_directories(CPackLib ${LibUUID_INCLUDE_DIRS})
  set_property(SOURCE CPack/cmCPackGeneratorFactory.cxx PROPERTY COMPILE_DEFINITIONS HAVE_LIBUUID)
endif()
1004
1005
1006
1007
1008
if(CPACK_ENABLE_FREEBSD_PKG AND FREEBSD_PKG_INCLUDE_DIRS AND FREEBSD_PKG_LIBRARIES)
  target_link_libraries(CPackLib ${FREEBSD_PKG_LIBRARIES})
  include_directories(${FREEBSD_PKG_INCLUDE_DIRS})
  add_definitions(-DHAVE_FREEBSD_PKG)
endif()
Andy Cedilnik's avatar
Andy Cedilnik committed
1009

1010
1011
if(APPLE)
  add_executable(cmakexbuild cmakexbuild.cxx)
1012
  list(APPEND _tools cmakexbuild)
1013
1014
  target_link_libraries(cmakexbuild CMakeLib)
  add_executable(OSXScriptLauncher
1015
    CPack/OSXScriptLauncher.cxx)
1016
1017
  target_link_libraries(OSXScriptLauncher cmsys)
  target_link_libraries(OSXScriptLauncher "-framework CoreFoundation")
1018
endif()
1019

1020
# Build CMake executable
1021
add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE})
1022
list(APPEND _tools cmake)
1023
target_link_libraries(cmake CMakeLib)
1024

Daniel Pfeifer's avatar
Daniel Pfeifer committed
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
add_library(CMakeServerLib
  cmConnection.h cmConnection.cxx
  cmFileMonitor.cxx cmFileMonitor.h
  cmPipeConnection.cxx cmPipeConnection.h
  cmServer.cxx cmServer.h
  cmServerConnection.cxx cmServerConnection.h
  cmServerProtocol.cxx cmServerProtocol.h
  )
target_link_libraries(CMakeServerLib CMakeLib)
target_link_libraries(cmake CMakeServerLib)
1035

1036
# Build CTest executable
1037
add_executable(ctest ctest.cxx ${MANIFEST_FILE})
1038
list(APPEND _tools ctest)
1039
target_link_libraries(ctest CTestLib)
Bill Hoffman's avatar
Bill Hoffman committed
1040

Andy Cedilnik's avatar
Andy Cedilnik committed
1041
# Build CPack executable
1042
add_executable(cpack CPack/cpack.cxx ${MANIFEST_FILE})
1043
list(APPEND _tools cpack)
1044
target_link_libraries(cpack CPackLib)
Andy Cedilnik's avatar
Andy Cedilnik committed
1045

1046
# Curses GUI
1047
1048
if(BUILD_CursesDialog)
  include(${CMake_SOURCE_DIR}/Source/CursesDialog/CMakeLists.txt)
1049
endif()
Bill Hoffman's avatar
Bill Hoffman committed
1050

Bill Hoffman's avatar
Bill Hoffman committed
1051
# Qt GUI
1052
1053
option(BUILD_QtDialog "Build Qt dialog for CMake" FALSE)
if(BUILD_QtDialog)
1054
  add_subdirectory(QtDialog)
1055
endif()
1056
1057
1058
1059

include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)

1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
if(WIN32)
  # Add Windows executable version information.
  configure_file("CMakeVersion.rc.in" "CMakeVersion.rc" @ONLY)

  # We use a separate object library for this to work around a limitation of
  # MinGW's windres tool with spaces in the path to the include directories.
  add_library(CMakeVersion OBJECT "${CMAKE_CURRENT_BINARY_DIR}/CMakeVersion.rc")
  set_property(TARGET CMakeVersion PROPERTY INCLUDE_DIRECTORIES "")
  foreach(_tool ${_tools})
    target_sources(${_tool} PRIVATE $<TARGET_OBJECTS:CMakeVersion>)
  endforeach()
endif()

1073
1074
1075
# Install tools

foreach(_tool ${_tools})
1076
  CMake_OPTIONAL_COMPONENT(${_tool})
1077
  install(TARGETS ${_tool} DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT})
1078
1079
endforeach()

1080
install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include)
1081
1082
1083

# Unset temporary variables
unset(_tools)