packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmTarget.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmTarget_h
13 #define cmTarget_h
14
15 #include "cmCustomCommand.h"
16 #include "cmPropertyMap.h"
17 #include "cmPolicies.h"
18 #include "cmListFileCache.h"
19
20 #include <cmsys/auto_ptr.hxx>
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
30 class cmake;
31 class cmMakefile;
32 class cmSourceFile;
33 class cmGlobalGenerator;
34 class cmComputeLinkInformation;
35 class cmListFileBacktrace;
36 class cmTarget;
37
38 struct cmTargetLinkInformationMap:
39   public std::map<std::pair<cmTarget*, std::string>, cmComputeLinkInformation*>
40 {
41   typedef std::map<std::pair<cmTarget*, std::string>,
42                    cmComputeLinkInformation*> derived;
43   cmTargetLinkInformationMap() {}
44   cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r);
45   ~cmTargetLinkInformationMap();
46 };
47
48 class cmTargetInternals;
49 class cmTargetInternalPointer
50 {
51 public:
52   cmTargetInternalPointer();
53   cmTargetInternalPointer(cmTargetInternalPointer const& r);
54   ~cmTargetInternalPointer();
55   cmTargetInternalPointer& operator=(cmTargetInternalPointer const& r);
56   cmTargetInternals* operator->() const { return this->Pointer; }
57   cmTargetInternals* Get() const { return this->Pointer; }
58 private:
59   cmTargetInternals* Pointer;
60 };
61
62 /** \class cmTarget
63  * \brief Represent a library or executable target loaded from a makefile.
64  *
65  * cmTarget represents a target loaded from
66  * a makefile.
67  */
68 class cmTarget
69 {
70 public:
71   cmTarget();
72   enum TargetType { EXECUTABLE, STATIC_LIBRARY,
73                     SHARED_LIBRARY, MODULE_LIBRARY,
74                     OBJECT_LIBRARY, UTILITY, GLOBAL_TARGET,
75                     UNKNOWN_LIBRARY};
76   static const char* GetTargetTypeName(TargetType targetType);
77   enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
78
79   /**
80    * Return the type of target.
81    */
82   TargetType GetType() const
83     {
84     return this->TargetTypeValue;
85     }
86
87   /**
88    * Set the target type
89    */
90   void SetType(TargetType f, const char* name);
91
92   void MarkAsImported();
93
94   ///! Set/Get the name of the target
95   const char* GetName() const {return this->Name.c_str();}
96   const char* GetExportName();
97
98   ///! Set the cmMakefile that owns this target
99   void SetMakefile(cmMakefile *mf);
100   cmMakefile *GetMakefile() const { return this->Makefile;};
101
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
109
110   /**
111    * Get the list of the custom commands for this target
112    */
113   std::vector<cmCustomCommand> &GetPreBuildCommands()
114     {return this->PreBuildCommands;}
115   std::vector<cmCustomCommand> &GetPreLinkCommands()
116     {return this->PreLinkCommands;}
117   std::vector<cmCustomCommand> &GetPostBuildCommands()
118     {return this->PostBuildCommands;}
119
120   /**
121    * Get the list of the source files used by this target
122    */
123   std::vector<cmSourceFile*> const& GetSourceFiles();
124   void AddSourceFile(cmSourceFile* sf);
125   std::vector<std::string> const& GetObjectLibraries() const
126     {
127     return this->ObjectLibraries;
128     }
129
130   /** Get sources that must be built before the given source.  */
131   std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf);
132
133   /**
134    * Flags for a given source file as used in this target. Typically assigned
135    * via SET_TARGET_PROPERTIES when the property is a list of source files.
136    */
137   enum SourceFileType
138   {
139     SourceFileTypeNormal,
140     SourceFileTypePrivateHeader, // is in "PRIVATE_HEADER" target property
141     SourceFileTypePublicHeader,  // is in "PUBLIC_HEADER" target property
142     SourceFileTypeResource,      // is in "RESOURCE" target property *or*
143                                  // has MACOSX_PACKAGE_LOCATION=="Resources"
144     SourceFileTypeMacContent     // has MACOSX_PACKAGE_LOCATION!="Resources"
145   };
146   struct SourceFileFlags
147   {
148     SourceFileFlags(): Type(SourceFileTypeNormal), MacFolder(0) {}
149     SourceFileFlags(SourceFileFlags const& r):
150       Type(r.Type), MacFolder(r.MacFolder) {}
151     SourceFileType Type;
152     const char* MacFolder; // location inside Mac content folders
153   };
154
155   /**
156    * Get the flags for a given source file as used in this target
157    */
158   struct SourceFileFlags GetTargetSourceFileFlags(const cmSourceFile* sf);
159
160   /**
161    * Add sources to the target.
162    */
163   void AddSources(std::vector<std::string> const& srcs);
164   cmSourceFile* AddSource(const char* src);
165
166   enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
167
168   //* how we identify a library, by name and type
169   typedef std::pair<cmStdString, LinkLibraryType> LibraryID;
170
171   typedef std::vector<LibraryID > LinkLibraryVectorType;
172   const LinkLibraryVectorType &GetLinkLibraries() const {
173   return this->LinkLibraries;}
174   const LinkLibraryVectorType &GetOriginalLinkLibraries() const
175     {return this->OriginalLinkLibraries;}
176   void GetDirectLinkLibraries(const char *config,
177                               std::vector<std::string> &,
178                               cmTarget *head);
179
180   /** Compute the link type to use for the given configuration.  */
181   LinkLibraryType ComputeLinkType(const char* config);
182
183   /**
184    * Clear the dependency information recorded for this target, if any.
185    */
186   void ClearDependencyInformation(cmMakefile& mf, const char* target);
187
188   // Check to see if a library is a framework and treat it different on Mac
189   bool NameResolvesToFramework(const std::string& libname);
190   void AddLinkLibrary(cmMakefile& mf,
191                       const char *target, const char* lib,
192                       LinkLibraryType llt);
193   enum TLLSignature {
194     KeywordTLLSignature,
195     PlainTLLSignature
196   };
197   bool PushTLLCommandTrace(TLLSignature signature);
198   void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const;
199
200   void MergeLinkLibraries( cmMakefile& mf, const char* selfname,
201                            const LinkLibraryVectorType& libs );
202
203   const std::vector<std::string>& GetLinkDirectories();
204
205   void AddLinkDirectory(const char* d);
206
207   /**
208    * Set the path where this target should be installed. This is relative to
209    * INSTALL_PREFIX
210    */
211   std::string GetInstallPath() {return this->InstallPath;}
212   void SetInstallPath(const char *name) {this->InstallPath = name;}
213
214   /**
215    * Set the path where this target (if it has a runtime part) should be
216    * installed. This is relative to INSTALL_PREFIX
217    */
218   std::string GetRuntimeInstallPath() {return this->RuntimeInstallPath;}
219   void SetRuntimeInstallPath(const char *name) {
220     this->RuntimeInstallPath = name; }
221
222   /**
223    * Get/Set whether there is an install rule for this target.
224    */
225   bool GetHaveInstallRule() { return this->HaveInstallRule; }
226   void SetHaveInstallRule(bool h) { this->HaveInstallRule = h; }
227
228   /** Add a utility on which this project depends. A utility is an executable
229    * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
230    * commands. It is not a full path nor does it have an extension.
231    */
232   void AddUtility(const char* u) { this->Utilities.insert(u);}
233   ///! Get the utilities used by this target
234   std::set<cmStdString>const& GetUtilities() const { return this->Utilities; }
235
236   /** Finalize the target at the end of the Configure step.  */
237   void FinishConfigure();
238
239   ///! Set/Get a property of this target file
240   void SetProperty(const char *prop, const char *value);
241   void AppendProperty(const char* prop, const char* value,bool asString=false);
242   const char *GetProperty(const char *prop);
243   const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
244   bool GetPropertyAsBool(const char *prop);
245   void CheckProperty(const char* prop, cmMakefile* context);
246
247   const char* GetFeature(const char* feature, const char* config);
248
249   bool IsImported() const {return this->IsImportedTarget;}
250
251   /** The link interface specifies transitive library dependencies and
252       other information needed by targets that link to this target.  */
253   struct LinkInterface
254   {
255     // Languages whose runtime libraries must be linked.
256     std::vector<std::string> Languages;
257
258     // Libraries listed in the interface.
259     std::vector<std::string> Libraries;
260
261     // Shared library dependencies needed for linking on some platforms.
262     std::vector<std::string> SharedDeps;
263
264     // Number of repetitions of a strongly connected component of two
265     // or more static libraries.
266     int Multiplicity;
267
268     // Libraries listed for other configurations.
269     // Needed only for OLD behavior of CMP0003.
270     std::vector<std::string> WrongConfigLibraries;
271
272     bool ImplementationIsInterface;
273
274     LinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
275   };
276
277   /** Get the link interface for the given configuration.  Returns 0
278       if the target cannot be linked.  */
279   LinkInterface const* GetLinkInterface(const char* config,
280                                         cmTarget *headTarget);
281   void GetTransitivePropertyLinkLibraries(const char* config,
282                                         cmTarget *headTarget,
283                                         std::vector<std::string> &libs);
284
285   /** The link implementation specifies the direct library
286       dependencies needed by the object files of the target.  */
287   struct LinkImplementation
288   {
289     // Languages whose runtime libraries must be linked.
290     std::vector<std::string> Languages;
291
292     // Libraries linked directly in this configuration.
293     std::vector<std::string> Libraries;
294
295     // Libraries linked directly in other configurations.
296     // Needed only for OLD behavior of CMP0003.
297     std::vector<std::string> WrongConfigLibraries;
298   };
299   LinkImplementation const* GetLinkImplementation(const char* config,
300                                                   cmTarget *head);
301
302   /** Link information from the transitive closure of the link
303       implementation and the interfaces of its dependencies.  */
304   struct LinkClosure
305   {
306     // The preferred linker language.
307     std::string LinkerLanguage;
308
309     // Languages whose runtime libraries must be linked.
310     std::vector<std::string> Languages;
311   };
312   LinkClosure const* GetLinkClosure(const char* config, cmTarget *head);
313
314   /** Strip off leading and trailing whitespace from an item named in
315       the link dependencies of this target.  */
316   std::string CheckCMP0004(std::string const& item);
317
318   /** Get the directory in which this target will be built.  If the
319       configuration name is given then the generator will add its
320       subdirectory for that configuration.  Otherwise just the canonical
321       output directory is given.  */
322   std::string GetDirectory(const char* config = 0, bool implib = false);
323
324   /** Get the directory in which this targets .pdb files will be placed.
325       If the configuration name is given then the generator will add its
326       subdirectory for that configuration.  Otherwise just the canonical
327       pdb output directory is given.  */
328   std::string GetPDBDirectory(const char* config = 0);
329
330   /** Get the location of the target in the build tree for the given
331       configuration.  This location is suitable for use as the LOCATION
332       target property.  */
333   const char* GetLocation(const char* config);
334
335   /** Get the target major and minor version numbers interpreted from
336       the VERSION property.  Version 0 is returned if the property is
337       not set or cannot be parsed.  */
338   void GetTargetVersion(int& major, int& minor);
339
340   /** Get the target major, minor, and patch version numbers
341       interpreted from the VERSION or SOVERSION property.  Version 0
342       is returned if the property is not set or cannot be parsed.  */
343   void GetTargetVersion(bool soversion, int& major, int& minor, int& patch);
344
345   /**
346    * Trace through the source files in this target and add al source files
347    * that they depend on, used by all generators
348    */
349   void TraceDependencies();
350
351   /**
352    * Make sure the full path to all source files is known.
353    */
354   bool FindSourceFiles();
355
356   ///! Return the preferred linker language for this target
357   const char* GetLinkerLanguage(const char* config = 0, cmTarget *head = 0);
358
359   /** Get the full name of the target according to the settings in its
360       makefile.  */
361   std::string GetFullName(const char* config=0, bool implib = false);
362   void GetFullNameComponents(std::string& prefix,
363                              std::string& base, std::string& suffix,
364                              const char* config=0, bool implib = false);
365
366   /** Get the name of the pdb file for the target.  */
367   std::string GetPDBName(const char* config=0);
368
369   /** Whether this library has soname enabled and platform supports it.  */
370   bool HasSOName(const char* config);
371
372   /** Get the soname of the target.  Allowed only for a shared library.  */
373   std::string GetSOName(const char* config);
374
375   /** Whether this library has @rpath and platform supports it.  */
376   bool HasMacOSXRpath(const char* config);
377
378   /** Test for special case of a third-party shared library that has
379       no soname at all.  */
380   bool IsImportedSharedLibWithoutSOName(const char* config);
381
382   /** Get the full path to the target according to the settings in its
383       makefile and the configuration type.  */
384   std::string GetFullPath(const char* config=0, bool implib = false,
385                           bool realname = false);
386
387   /** Get the names of the library needed to generate a build rule
388       that takes into account shared library version numbers.  This
389       should be called only on a library target.  */
390   void GetLibraryNames(std::string& name, std::string& soName,
391                        std::string& realName, std::string& impName,
392                        std::string& pdbName, const char* config);
393
394   /** Get the names of the executable needed to generate a build rule
395       that takes into account executable version numbers.  This should
396       be called only on an executable target.  */
397   void GetExecutableNames(std::string& name, std::string& realName,
398                           std::string& impName,
399                           std::string& pdbName, const char* config);
400
401   /** Does this target have a GNU implib to convert to MS format?  */
402   bool HasImplibGNUtoMS();
403
404   /** Convert the given GNU import library name (.dll.a) to a name with a new
405       extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}).  */
406   bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
407                         const char* newExt = 0);
408
409   /** Add the target output files to the global generator manifest.  */
410   void GenerateTargetManifest(const char* config);
411
412   /**
413    * Compute whether this target must be relinked before installing.
414    */
415   bool NeedRelinkBeforeInstall(const char* config);
416
417   bool HaveBuildTreeRPATH(const char *config);
418   bool HaveInstallTreeRPATH();
419
420   /** Return true if builtin chrpath will work for this target */
421   bool IsChrpathUsed(const char* config);
422
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();
431
432   cmComputeLinkInformation* GetLinkInformation(const char* config,
433                                                cmTarget *head = 0);
434
435   // Get the properties
436   cmPropertyMap &GetProperties() { return this->Properties; };
437
438   bool GetMappedConfig(std::string const& desired_config,
439                        const char** loc,
440                        const char** imp,
441                        std::string& suffix);
442
443   // Define the properties
444   static void DefineProperties(cmake *cm);
445
446   /** Get the macro to define when building sources in this target.
447       If no macro should be defined null is returned.  */
448   const char* GetExportMacro();
449
450   void GetCompileDefinitions(std::vector<std::string> &result,
451                              const char *config);
452
453   // Compute the set of languages compiled by the target.  This is
454   // computed every time it is called because the languages can change
455   // when source file properties are changed and we do not have enough
456   // information to forward these property changes to the targets
457   // until we have per-target object file properties.
458   void GetLanguages(std::set<cmStdString>& languages) const;
459
460   /** Return whether this target is an executable with symbol exports
461       enabled.  */
462   bool IsExecutableWithExports();
463
464   /** Return whether this target may be used to link another target.  */
465   bool IsLinkable();
466
467   /** Return whether or not the target is for a DLL platform.  */
468   bool IsDLLPlatform() { return this->DLLPlatform; }
469
470   /** Return whether or not the target has a DLL import library.  */
471   bool HasImportLibrary();
472
473   /** Return whether this target is a shared library Framework on
474       Apple.  */
475   bool IsFrameworkOnApple();
476
477   /** Return whether this target is a CFBundle (plugin) on Apple.  */
478   bool IsCFBundleOnApple();
479
480   /** Return whether this target is an executable Bundle on Apple.  */
481   bool IsAppBundleOnApple();
482
483   /** Return whether this target is an executable Bundle, a framework
484       or CFBundle on Apple.  */
485   bool IsBundleOnApple();
486
487   /** Return the framework version string.  Undefined if
488       IsFrameworkOnApple returns false.  */
489   std::string GetFrameworkVersion();
490
491   /** Get a backtrace from the creation of the target.  */
492   cmListFileBacktrace const& GetBacktrace() const;
493
494   /** Get a build-tree directory in which to place target support files.  */
495   std::string GetSupportDirectory() const;
496
497   /** Return whether this target uses the default value for its output
498       directory.  */
499   bool UsesDefaultOutputDir(const char* config, bool implib);
500
501   /** @return the mac content directory for this target. */
502   std::string GetMacContentDirectory(const char* config,
503                                      bool implib);
504
505   /** @return whether this target have a well defined output file name. */
506   bool HaveWellDefinedOutputFiles();
507
508   /** @return the Mac framework directory without the base. */
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);
516
517   std::vector<std::string> GetIncludeDirectories(const char *config);
518   void InsertInclude(const cmValueWithOrigin &entry,
519                      bool before = false);
520   void InsertCompileOption(const cmValueWithOrigin &entry,
521                      bool before = false);
522   void InsertCompileDefinition(const cmValueWithOrigin &entry,
523                      bool before = false);
524
525   void AppendBuildInterfaceIncludes();
526
527   void GetCompileOptions(std::vector<std::string> &result,
528                          const char *config);
529
530   bool IsNullImpliedByLinkLibraries(const std::string &p);
531   bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
532                                             const char *config);
533   bool IsLinkInterfaceDependentStringProperty(const std::string &p,
534                                               const char *config);
535
536   bool GetLinkInterfaceDependentBoolProperty(const std::string &p,
537                                              const char *config);
538
539   const char *GetLinkInterfaceDependentStringProperty(const std::string &p,
540                                                       const char *config);
541
542   std::string GetDebugGeneratorExpressions(const std::string &value,
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
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
562   /**
563    * A list of direct dependencies. Use in conjunction with DependencyMap.
564    */
565   typedef std::vector< LibraryID > DependencyList;
566
567   /**
568    * This map holds the dependency graph. map[x] returns a set of
569    * direct dependencies of x. Note that the direct depenencies are
570    * ordered. This is necessary to handle direct dependencies that
571    * themselves have no dependency information.
572    */
573   typedef std::map< LibraryID, DependencyList > DependencyMap;
574
575   /**
576    * Inserts \a dep at the end of the dependency list of \a lib.
577    */
578   void InsertDependency( DependencyMap& depMap,
579                          const LibraryID& lib,
580                          const LibraryID& dep);
581
582   /*
583    * Deletes \a dep from the dependency list of \a lib.
584    */
585   void DeleteDependency( DependencyMap& depMap,
586                          const LibraryID& lib,
587                          const LibraryID& dep);
588
589   /**
590    * Emits the library \a lib and all its dependencies into link_line.
591    * \a emitted keeps track of the libraries that have been emitted to
592    * avoid duplicates--it is more efficient than searching
593    * link_line. \a visited is used detect cycles. Note that \a
594    * link_line is in reverse order, in that the dependencies of a
595    * library are listed before the library itself.
596    */
597   void Emit( const LibraryID lib,
598              const DependencyMap& dep_map,
599              std::set<LibraryID>& emitted,
600              std::set<LibraryID>& visited,
601              DependencyList& link_line);
602
603   /**
604    * Finds the dependencies for \a lib and inserts them into \a
605    * dep_map.
606    */
607   void GatherDependencies( const cmMakefile& mf,
608                            const LibraryID& lib,
609                            DependencyMap& dep_map);
610
611   void AnalyzeLibDependencies( const cmMakefile& mf );
612
613   const char* GetSuffixVariableInternal(bool implib);
614   const char* GetPrefixVariableInternal(bool implib);
615   std::string GetFullNameInternal(const char* config, bool implib);
616   void GetFullNameInternal(const char* config, bool implib,
617                            std::string& outPrefix, std::string& outBase,
618                            std::string& outSuffix);
619
620   // Use a makefile variable to set a default for the given property.
621   // If the variable is not defined use the given default instead.
622   void SetPropertyDefault(const char* property, const char* default_value);
623
624   // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
625   const char* GetOutputTargetType(bool implib);
626
627   // Get the target base name.
628   std::string GetOutputName(const char* config, bool implib);
629
630   const char* ImportedGetLocation(const char* config);
631   const char* NormalGetLocation(const char* config);
632
633   std::string GetFullNameImported(const char* config, bool implib);
634
635   std::string ImportedGetFullPath(const char* config, bool implib);
636   std::string NormalGetFullPath(const char* config, bool implib,
637                                 bool realname);
638
639   /** Get the real name of the target.  Allowed only for non-imported
640       targets.  When a library or executable file is versioned this is
641       the full versioned name.  If the target is not versioned this is
642       the same as GetFullName.  */
643   std::string NormalGetRealName(const char* config);
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
650 private:
651   std::string Name;
652   std::vector<cmCustomCommand> PreBuildCommands;
653   std::vector<cmCustomCommand> PreLinkCommands;
654   std::vector<cmCustomCommand> PostBuildCommands;
655   TargetType TargetTypeValue;
656   std::vector<cmSourceFile*> SourceFiles;
657   std::vector<std::string> ObjectLibraries;
658   LinkLibraryVectorType LinkLibraries;
659   LinkLibraryVectorType PrevLinkedLibraries;
660   bool LinkLibrariesAnalyzed;
661   std::vector<std::string> LinkDirectories;
662   std::set<cmStdString> LinkDirectoriesEmmitted;
663   bool HaveInstallRule;
664   std::string InstallPath;
665   std::string RuntimeInstallPath;
666   std::string Location;
667   std::string ExportMacro;
668   std::set<cmStdString> Utilities;
669   bool RecordDependencies;
670   cmPropertyMap Properties;
671   LinkLibraryVectorType OriginalLinkLibraries;
672   bool DLLPlatform;
673   bool IsApple;
674   bool IsImportedTarget;
675   bool DebugIncludesDone;
676   bool DebugCompileOptionsDone;
677   bool DebugCompileDefinitionsDone;
678   mutable std::set<std::string> LinkImplicitNullProperties;
679   bool BuildInterfaceIncludesAppended;
680
681   // Cache target output paths for each configuration.
682   struct OutputInfo;
683   OutputInfo const* GetOutputInfo(const char* config);
684   bool ComputeOutputDir(const char* config, bool implib, std::string& out);
685   bool ComputePDBOutputDir(const char* config, std::string& out);
686
687   // Cache import information from properties for each configuration.
688   struct ImportInfo;
689   ImportInfo const* GetImportInfo(const char* config,
690                                         cmTarget *workingTarget);
691   void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
692                                         cmTarget *head);
693
694   cmTargetLinkInformationMap LinkInformation;
695   void CheckPropertyCompatibility(cmComputeLinkInformation *info,
696                                   const char* config);
697
698   bool ComputeLinkInterface(const char* config, LinkInterface& iface,
699                                         cmTarget *head);
700
701   void ComputeLinkImplementation(const char* config,
702                                  LinkImplementation& impl, cmTarget *head);
703   void ComputeLinkClosure(const char* config, LinkClosure& lc, cmTarget *head);
704
705   void ClearLinkMaps();
706
707   void MaybeInvalidatePropertyCache(const char* prop);
708
709   void ProcessSourceExpression(std::string const& expr);
710
711   // The cmMakefile instance that owns this target.  This should
712   // always be set.
713   cmMakefile* Makefile;
714
715   // Policy status recorded when target was created.
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
722
723   // Internal representation details.
724   friend class cmTargetInternals;
725   cmTargetInternalPointer Internal;
726
727   void ConstructSourceFileFlags();
728   void ComputeVersionedName(std::string& vName,
729                             std::string const& prefix,
730                             std::string const& base,
731                             std::string const& suffix,
732                             std::string const& name,
733                             const char* version);
734 };
735
736 typedef std::map<cmStdString,cmTarget> cmTargets;
737
738 class cmTargetSet: public std::set<cmStdString> {};
739 class cmTargetManifest: public std::map<cmStdString, cmTargetSet> {};
740
741 #endif