~ubuntu-branches/ubuntu/utopic/cmake/utopic

« back to all changes in this revision

Viewing changes to Source/cmTarget.h

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-10-10 12:54:39 UTC
  • mfrom: (1.14.7)
  • Revision ID: package-import@ubuntu.com-20131010125439-h0ahaj004on6oj92
Tags: 2.8.12-0ubuntu1
New upstream release LP: #1246701

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include <cmsys/auto_ptr.hxx>
21
21
 
 
22
#define CM_FOR_EACH_TARGET_POLICY(F) \
 
23
  F(CMP0003) \
 
24
  F(CMP0004) \
 
25
  F(CMP0008) \
 
26
  F(CMP0020) \
 
27
  F(CMP0021) \
 
28
  F(CMP0022)
 
29
 
22
30
class cmake;
23
31
class cmMakefile;
24
32
class cmSourceFile;
85
93
 
86
94
  ///! Set/Get the name of the target
87
95
  const char* GetName() const {return this->Name.c_str();}
 
96
  const char* GetExportName();
88
97
 
89
98
  ///! Set the cmMakefile that owns this target
90
99
  void SetMakefile(cmMakefile *mf);
91
100
  cmMakefile *GetMakefile() const { return this->Makefile;};
92
101
 
93
 
  /** Get the status of policy CMP0003 when the target was created.  */
94
 
  cmPolicies::PolicyStatus GetPolicyStatusCMP0003() const
95
 
    { return this->PolicyStatusCMP0003; }
96
 
 
97
 
  /** Get the status of policy CMP0004 when the target was created.  */
98
 
  cmPolicies::PolicyStatus GetPolicyStatusCMP0004() const
99
 
    { return this->PolicyStatusCMP0004; }
100
 
 
101
 
  /** Get the status of policy CMP0008 when the target was created.  */
102
 
  cmPolicies::PolicyStatus GetPolicyStatusCMP0008() const
103
 
    { return this->PolicyStatusCMP0008; }
104
 
 
105
 
  /** Get the status of policy CMP0020 when the target was created.  */
106
 
  cmPolicies::PolicyStatus GetPolicyStatusCMP0020() const
107
 
    { return this->PolicyStatusCMP0020; }
 
102
#define DECLARE_TARGET_POLICY(POLICY) \
 
103
  cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
 
104
    { return this->PolicyStatus ## POLICY; }
 
105
 
 
106
  CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
 
107
 
 
108
#undef DECLARE_TARGET_POLICY
108
109
 
109
110
  /**
110
111
   * Get the list of the custom commands for this target
189
190
  void AddLinkLibrary(cmMakefile& mf,
190
191
                      const char *target, const char* lib,
191
192
                      LinkLibraryType llt);
 
193
  enum TLLSignature {
 
194
    KeywordTLLSignature,
 
195
    PlainTLLSignature
 
196
  };
 
197
  bool PushTLLCommandTrace(TLLSignature signature);
 
198
  void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const;
192
199
 
193
200
  void MergeLinkLibraries( cmMakefile& mf, const char* selfname,
194
201
                           const LinkLibraryVectorType& libs );
271
278
      if the target cannot be linked.  */
272
279
  LinkInterface const* GetLinkInterface(const char* config,
273
280
                                        cmTarget *headTarget);
 
281
  void GetTransitivePropertyLinkLibraries(const char* config,
 
282
                                        cmTarget *headTarget,
 
283
                                        std::vector<std::string> &libs);
274
284
 
275
285
  /** The link implementation specifies the direct library
276
286
      dependencies needed by the object files of the target.  */
336
346
   * Trace through the source files in this target and add al source files
337
347
   * that they depend on, used by all generators
338
348
   */
339
 
  void TraceDependencies(const char* vsProjectFile);
 
349
  void TraceDependencies();
340
350
 
341
351
  /**
342
352
   * Make sure the full path to all source files is known.
362
372
  /** Get the soname of the target.  Allowed only for a shared library.  */
363
373
  std::string GetSOName(const char* config);
364
374
 
 
375
  /** Whether this library has @rpath and platform supports it.  */
 
376
  bool HasMacOSXRpath(const char* config);
 
377
 
365
378
  /** Test for special case of a third-party shared library that has
366
379
      no soname at all.  */
367
380
  bool IsImportedSharedLibWithoutSOName(const char* config);
407
420
  /** Return true if builtin chrpath will work for this target */
408
421
  bool IsChrpathUsed(const char* config);
409
422
 
410
 
  std::string GetInstallNameDirForBuildTree(const char* config,
411
 
                                            bool for_xcode = false);
412
 
  std::string GetInstallNameDirForInstallTree(const char* config,
413
 
                                              bool for_xcode = false);
 
423
  /** Return the install name directory for the target in the
 
424
    * build tree.  For example: "@rpath/", "@loader_path/",
 
425
    * or "/full/path/to/library".  */
 
426
  std::string GetInstallNameDirForBuildTree(const char* config);
 
427
 
 
428
  /** Return the install name directory for the target in the
 
429
    * install tree.  For example: "@rpath/" or "@loader_path/". */
 
430
  std::string GetInstallNameDirForInstallTree();
414
431
 
415
432
  cmComputeLinkInformation* GetLinkInformation(const char* config,
416
433
                                               cmTarget *head = 0);
430
447
      If no macro should be defined null is returned.  */
431
448
  const char* GetExportMacro();
432
449
 
433
 
  std::string GetCompileDefinitions(const char *config);
 
450
  void GetCompileDefinitions(std::vector<std::string> &result,
 
451
                             const char *config);
434
452
 
435
453
  // Compute the set of languages compiled by the target.  This is
436
454
  // computed every time it is called because the languages can change
462
480
  /** Return whether this target is an executable Bundle on Apple.  */
463
481
  bool IsAppBundleOnApple();
464
482
 
 
483
  /** Return whether this target is an executable Bundle, a framework
 
484
      or CFBundle on Apple.  */
 
485
  bool IsBundleOnApple();
 
486
 
465
487
  /** Return the framework version string.  Undefined if
466
488
      IsFrameworkOnApple returns false.  */
467
489
  std::string GetFrameworkVersion();
476
498
      directory.  */
477
499
  bool UsesDefaultOutputDir(const char* config, bool implib);
478
500
 
479
 
  /** Append to @a base the mac content directory and return it. */
480
 
  std::string BuildMacContentDirectory(const std::string& base,
481
 
                                       const char* config = 0,
482
 
                                       bool includeMacOS = true);
483
 
 
484
501
  /** @return the mac content directory for this target. */
485
 
  std::string GetMacContentDirectory(const char* config = 0,
486
 
                                     bool implib = false,
487
 
                                     bool includeMacOS = true);
 
502
  std::string GetMacContentDirectory(const char* config,
 
503
                                     bool implib);
488
504
 
489
505
  /** @return whether this target have a well defined output file name. */
490
506
  bool HaveWellDefinedOutputFiles();
491
507
 
492
508
  /** @return the Mac framework directory without the base. */
493
 
  std::string GetFrameworkDirectory(const char* config = 0);
 
509
  std::string GetFrameworkDirectory(const char* config, bool rootDir);
 
510
 
 
511
  /** @return the Mac CFBundle directory without the base */
 
512
  std::string GetCFBundleDirectory(const char* config, bool contentOnly);
 
513
 
 
514
  /** @return the Mac App directory without the base */
 
515
  std::string GetAppBundleDirectory(const char* config, bool contentOnly);
494
516
 
495
517
  std::vector<std::string> GetIncludeDirectories(const char *config);
496
518
  void InsertInclude(const cmValueWithOrigin &entry,
497
519
                     bool before = false);
 
520
  void InsertCompileOption(const cmValueWithOrigin &entry,
 
521
                     bool before = false);
 
522
  void InsertCompileDefinition(const cmValueWithOrigin &entry,
 
523
                     bool before = false);
498
524
 
499
525
  void AppendBuildInterfaceIncludes();
500
526
 
 
527
  void GetCompileOptions(std::vector<std::string> &result,
 
528
                         const char *config);
 
529
 
501
530
  bool IsNullImpliedByLinkLibraries(const std::string &p);
502
531
  bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
503
532
                                            const char *config);
512
541
 
513
542
  std::string GetDebugGeneratorExpressions(const std::string &value,
514
543
                                  cmTarget::LinkLibraryType llt);
 
544
 
 
545
  void AddSystemIncludeDirectories(const std::set<cmStdString> &incs);
 
546
  void AddSystemIncludeDirectories(const std::vector<std::string> &incs);
 
547
  std::set<cmStdString> const & GetSystemIncludeDirectories() const
 
548
    { return this->SystemIncludeDirectories; }
 
549
 
 
550
  void FinalizeSystemIncludeDirectories();
 
551
 
 
552
  bool LinkLanguagePropagatesToDependents() const
 
553
  { return this->TargetTypeValue == STATIC_LIBRARY; }
 
554
 
515
555
private:
 
556
  // The set of include directories that are marked as system include
 
557
  // directories.
 
558
  std::set<cmStdString> SystemIncludeDirectories;
 
559
 
 
560
  std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands;
 
561
 
516
562
  /**
517
563
   * A list of direct dependencies. Use in conjunction with DependencyMap.
518
564
   */
596
642
      the same as GetFullName.  */
597
643
  std::string NormalGetRealName(const char* config);
598
644
 
 
645
  /** Append to @a base the mac content directory and return it. */
 
646
  std::string BuildMacContentDirectory(const std::string& base,
 
647
                                       const char* config,
 
648
                                       bool contentOnly);
 
649
 
599
650
private:
600
651
  std::string Name;
601
652
  std::vector<cmCustomCommand> PreBuildCommands;
622
673
  bool IsApple;
623
674
  bool IsImportedTarget;
624
675
  bool DebugIncludesDone;
 
676
  bool DebugCompileOptionsDone;
 
677
  bool DebugCompileDefinitionsDone;
625
678
  mutable std::set<std::string> LinkImplicitNullProperties;
626
679
  bool BuildInterfaceIncludesAppended;
627
680
 
660
713
  cmMakefile* Makefile;
661
714
 
662
715
  // Policy status recorded when target was created.
663
 
  cmPolicies::PolicyStatus PolicyStatusCMP0003;
664
 
  cmPolicies::PolicyStatus PolicyStatusCMP0004;
665
 
  cmPolicies::PolicyStatus PolicyStatusCMP0008;
666
 
  cmPolicies::PolicyStatus PolicyStatusCMP0020;
 
716
#define TARGET_POLICY_MEMBER(POLICY) \
 
717
  cmPolicies::PolicyStatus PolicyStatus ## POLICY;
 
718
 
 
719
  CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_MEMBER)
 
720
 
 
721
#undef TARGET_POLICY_MEMBER
667
722
 
668
723
  // Internal representation details.
669
724
  friend class cmTargetInternals;