Selaa lähdekoodia

Merge topic 'data-layout'

8174e5cd cmCustomCommand: Remove special member functions.
34e1d6db cmCustomCommand: Re-arrange data layout.
54cb76f2 cmComputeLinkDepends: Re-arrange data layout.
b661d6c6 cmQtAutoGenerators: Re-arrange data layout.
40844a14 cmProcessTools: Re-arrange data layout.
b1ff32af cmOrderDirectories: Re-arrange data layout.
dd0417c7 cmInstallTargetGenerator: Re-arrange data layout.
125c4866 cmInstallFilesGenerator: Re-arrange data layout.
92b8b1fc cmGraphVizWriter: Re-arrange data layout.
7f3e1623 cmGlobalGenerator: Re-arrange data layout.
d9df7fa7 cmComputeComponentGraph: Re-arrange data layout.
db24e41b cmCommandArgumentParserHelper: Re-arrange data.
4cd13e80 cmComputeLinkInformation: Re-arrange data layout.
3e087a40 cmLocalUnixMakefileGenerator: Re-arrange data layout.
e0421701 cmMakefile: Re-arrange data layout.
c26696eb cmSourceFile: Re-arrange data.
...
Brad King 10 vuotta sitten
vanhempi
sitoutus
d17aa60659
45 muutettua tiedostoa jossa 272 lisäystä ja 385 poistoa
  1. 4 11
      Source/cmCPluginAPI.cxx
  2. 3 8
      Source/cmCacheManager.cxx
  3. 4 4
      Source/cmCommandArgumentParserHelper.h
  4. 2 2
      Source/cmComputeComponentGraph.h
  5. 7 11
      Source/cmComputeLinkDepends.h
  6. 17 18
      Source/cmComputeLinkInformation.h
  7. 3 50
      Source/cmCustomCommand.cxx
  8. 3 7
      Source/cmCustomCommand.h
  9. 5 3
      Source/cmGetCMakePropertyCommand.cxx
  10. 5 1
      Source/cmGetDirectoryPropertyCommand.cxx
  11. 2 4
      Source/cmGetPropertyCommand.cxx
  12. 5 1
      Source/cmGetSourceFilePropertyCommand.cxx
  13. 5 1
      Source/cmGetTargetPropertyCommand.cxx
  14. 5 1
      Source/cmGetTestPropertyCommand.cxx
  15. 0 1
      Source/cmGlobalGenerator.cxx
  16. 8 6
      Source/cmGlobalGenerator.h
  17. 1 1
      Source/cmGraphVizWriter.cxx
  18. 7 8
      Source/cmGraphVizWriter.h
  19. 4 2
      Source/cmInstallFilesGenerator.cxx
  20. 1 1
      Source/cmInstallFilesGenerator.h
  21. 3 1
      Source/cmInstallTargetGenerator.cxx
  22. 2 4
      Source/cmInstallTargetGenerator.h
  23. 7 16
      Source/cmLocalUnixMakefileGenerator3.h
  24. 9 11
      Source/cmMakefile.cxx
  25. 8 11
      Source/cmMakefile.h
  26. 2 3
      Source/cmOrderDirectories.h
  27. 17 16
      Source/cmPolicies.cxx
  28. 2 6
      Source/cmPolicies.h
  29. 1 1
      Source/cmProcessTools.cxx
  30. 3 3
      Source/cmProcessTools.h
  31. 2 5
      Source/cmProperty.cxx
  32. 2 4
      Source/cmProperty.h
  33. 4 4
      Source/cmPropertyDefinitionMap.cxx
  34. 2 2
      Source/cmPropertyDefinitionMap.h
  35. 8 21
      Source/cmPropertyMap.cxx
  36. 3 15
      Source/cmPropertyMap.h
  37. 1 2
      Source/cmQtAutoGenerators.h
  38. 4 2
      Source/cmSetTestsPropertiesCommand.cxx
  39. 10 9
      Source/cmSourceFile.cxx
  40. 2 2
      Source/cmSourceFile.h
  41. 24 13
      Source/cmState.cxx
  42. 6 4
      Source/cmState.h
  43. 25 44
      Source/cmTarget.cxx
  44. 24 37
      Source/cmTarget.h
  45. 10 8
      Source/cmTest.cxx

+ 4 - 11
Source/cmCPluginAPI.cxx

@@ -526,11 +526,9 @@ void * CCONV cmCreateSourceFile(void)
   return (void*)new cmCPluginAPISourceFile;
 }
 
-void * CCONV cmCreateNewSourceFile(void *arg)
+void * CCONV cmCreateNewSourceFile(void *)
 {
-  cmMakefile *mf = static_cast<cmMakefile *>(arg);
   cmCPluginAPISourceFile *sf = new cmCPluginAPISourceFile;
-  sf->Properties.SetCMakeInstance(mf->GetCMakeInstance());
   return (void*)sf;
 }
 
@@ -630,11 +628,7 @@ const char * CCONV  cmSourceFileGetProperty(void *arg,const char *prop)
       {
       return sf->FullPath.c_str();
       }
-    bool chain = false;
-    // Ignore chain because old code will not expect it and it is a
-    // pain to implement here anyway.
-    return sf->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE,
-                                           chain);
+    return sf->Properties.GetPropertyValue(prop);
     }
 }
 
@@ -662,7 +656,7 @@ void CCONV cmSourceFileSetProperty(void *arg,const char *prop,
   else if(prop)
     {
     if(!value) { value = "NOTFOUND"; }
-    sf->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE);
+    sf->Properties.SetProperty(prop, value);
     }
 }
 
@@ -801,8 +795,7 @@ void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir,
   // Implement the old SetName method code here.
   if(headerFileOnly)
     {
-    sf->Properties.SetProperty("HEADER_FILE_ONLY", "1",
-                               cmProperty::SOURCE_FILE);
+    sf->Properties.SetProperty("HEADER_FILE_ONLY", "1");
     }
   sf->SourceName = name;
   std::string fname = sf->SourceName;

+ 3 - 8
Source/cmCacheManager.cxx

@@ -161,7 +161,6 @@ bool cmCacheManager::LoadCache(const std::string& path,
     // Format is key:type=value
     std::string helpString;
     CacheEntry e;
-    e.Properties.SetCMakeInstance(this->CMakeInstance);
     cmSystemTools::GetLineFromStream(fin, buffer);
     realbuffer = buffer.c_str();
     while(*realbuffer != '0' &&
@@ -323,7 +322,6 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
         {
         // Create an entry and store the property.
         CacheEntry& ne = this->Cache[key];
-        ne.Properties.SetCMakeInstance(this->CMakeInstance);
         ne.Type = cmState::UNINITIALIZED;
         ne.SetProperty(*p, e.Value.c_str());
         }
@@ -645,7 +643,6 @@ void cmCacheManager::AddCacheEntry(const std::string& key,
                                    cmState::CacheEntryType type)
 {
   CacheEntry& e = this->Cache[key];
-  e.Properties.SetCMakeInstance(this->CMakeInstance);
   if ( value )
     {
     e.Value = value;
@@ -744,9 +741,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
     {
     return this->Value.c_str();
     }
-  bool c = false;
-  return
-    this->Properties.GetPropertyValue(prop, cmProperty::CACHE, c);
+  return this->Properties.GetPropertyValue(prop);
 }
 
 //----------------------------------------------------------------------------
@@ -763,7 +758,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
     }
   else
     {
-    this->Properties.SetProperty(prop, value, cmProperty::CACHE);
+    this->Properties.SetProperty(prop, value);
     }
 }
 
@@ -789,7 +784,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
     }
   else
     {
-    this->Properties.AppendProperty(prop, value, cmProperty::CACHE, asString);
+    this->Properties.AppendProperty(prop, value, asString);
     }
 }
 

+ 4 - 4
Source/cmCommandArgumentParserHelper.h

@@ -80,8 +80,6 @@ private:
   std::string::size_type InputBufferPos;
   std::string InputBuffer;
   std::vector<char> OutputBuffer;
-  int CurrentLine;
-  int Verbose;
 
   void Print(const char* place, const char* str);
   void SafePrintMissing(const char* str, int line, int cnt);
@@ -94,12 +92,14 @@ private:
   std::vector<char*> Variables;
   const cmMakefile* Makefile;
   std::string Result;
+  std::string ErrorString;
   const char* FileName;
+  long FileLine;
+  int CurrentLine;
+  int Verbose;
   bool WarnUninitialized;
   bool CheckSystemVars;
-  long FileLine;
   bool EscapeQuotes;
-  std::string ErrorString;
   bool NoEscapeMode;
   bool ReplaceAtSyntax;
   bool RemoveEmpty;

+ 2 - 2
Source/cmComputeComponentGraph.h

@@ -67,17 +67,17 @@ private:
     int Root;
     int VisitIndex;
   };
-  int TarjanWalkId;
   std::vector<int> TarjanVisited;
   std::vector<int> TarjanComponents;
   std::vector<TarjanEntry> TarjanEntries;
+  std::vector<NodeList> Components;
   std::stack<int> TarjanStack;
+  int TarjanWalkId;
   int TarjanIndex;
   void Tarjan();
   void TarjanVisit(int i);
 
   // Connected components.
-  std::vector<NodeList> Components;
 };
 
 #endif

+ 7 - 11
Source/cmComputeLinkDepends.h

@@ -61,14 +61,7 @@ private:
   cmMakefile* Makefile;
   cmGlobalGenerator const* GlobalGenerator;
   cmake* CMakeInstance;
-  bool DebugMode;
-
-  // Configuration information.
-  bool HasConfig;
   std::string Config;
-  cmTarget::LinkLibraryType LinkType;
-
-  // Output information.
   EntryVector FinalLinkEntries;
 
   typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType;
@@ -131,7 +124,7 @@ private:
   void OrderLinkEntires();
   std::vector<char> ComponentVisited;
   std::vector<int> ComponentOrder;
-  int ComponentOrderId;
+
   struct PendingComponent
   {
     // The real component id.  Needed because the map is indexed by
@@ -158,11 +151,14 @@ private:
 
   // Record of the original link line.
   std::vector<int> OriginalEntries;
+  std::set<cmTarget const*> OldWrongConfigItems;
+  void CheckWrongConfigItem(cmLinkItem const& item);
 
-  // Compatibility help.
+  int ComponentOrderId;
+  cmTarget::LinkLibraryType LinkType;
+  bool HasConfig;
+  bool DebugMode;
   bool OldLinkDirMode;
-  void CheckWrongConfigItem(cmLinkItem const& item);
-  std::set<cmTarget const*> OldWrongConfigItems;
 };
 
 #endif

+ 17 - 18
Source/cmComputeLinkInformation.h

@@ -80,7 +80,6 @@ private:
   // Configuration information.
   std::string Config;
   std::string LinkLanguage;
-  bool LinkDependsNoShared;
 
   // Modes for dealing with dependent shared libraries.
   enum SharedDepMode
@@ -91,8 +90,6 @@ private:
     SharedDepModeLink    // List file on link line
   };
 
-  // System info.
-  bool UseImportLibrary;
   const char* LoaderFlag;
   std::string LibLinkFlag;
   std::string LibLinkFileFlag;
@@ -100,22 +97,18 @@ private:
   std::string RuntimeFlag;
   std::string RuntimeSep;
   std::string RuntimeAlways;
-  bool RuntimeUseChrpath;
-  bool NoSONameUsesPath;
-  bool LinkWithRuntimePath;
   std::string RPathLinkFlag;
   SharedDepMode SharedDependencyMode;
 
+  enum LinkType { LinkUnknown, LinkStatic, LinkShared };
+  void SetCurrentLinkType(LinkType lt);
+
   // Link type adjustment.
   void ComputeLinkTypeInfo();
-  enum LinkType { LinkUnknown, LinkStatic, LinkShared };
   LinkType StartLinkType;
   LinkType CurrentLinkType;
   std::string StaticLinkTypeFlag;
   std::string SharedLinkTypeFlag;
-  bool LinkTypeEnabled;
-  void SetCurrentLinkType(LinkType lt);
-  bool ArchivesMayBeShared;
 
   // Link item parsing.
   void ComputeItemParserInfo();
@@ -127,7 +120,6 @@ private:
   cmsys::RegularExpression ExtractSharedLibraryName;
   cmsys::RegularExpression ExtractAnyLibraryName;
   std::string SharedRegexString;
-  bool OpenBSD;
   void AddLinkPrefix(const char* p);
   void AddLinkExtension(const char* e, LinkType type);
   std::string CreateExtensionRegex(std::vector<std::string> const& exts,
@@ -171,20 +163,27 @@ private:
   std::set<std::string> OldLinkDirMask;
   std::vector<std::string> OldLinkDirItems;
   std::vector<std::string> OldUserFlagItems;
-  bool OldLinkDirMode;
-
-  // CMP0060 warnings.
-  bool CMP0060Warn;
   std::set<std::string> CMP0060WarnItems;
-
+  // Dependent library path computation.
+  cmOrderDirectories* OrderDependentRPath;
   // Runtime path computation.
   cmOrderDirectories* OrderRuntimeSearchPath;
+
+  bool OldLinkDirMode;
+  bool OpenBSD;
+  bool LinkDependsNoShared;
+  bool UseImportLibrary;
+  bool RuntimeUseChrpath;
+  bool NoSONameUsesPath;
+  bool LinkWithRuntimePath;
+  bool LinkTypeEnabled;
+  bool ArchivesMayBeShared;
+  bool CMP0060Warn;
+
   void AddLibraryRuntimeInfo(std::string const& fullPath,
                              cmTarget const* target);
   void AddLibraryRuntimeInfo(std::string const& fullPath);
 
-  // Dependent library path computation.
-  cmOrderDirectories* OrderDependentRPath;
 };
 
 #endif

+ 3 - 50
Source/cmCustomCommand.cxx

@@ -25,46 +25,6 @@ cmCustomCommand::cmCustomCommand()
   this->UsesTerminal = false;
 }
 
-//----------------------------------------------------------------------------
-cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
-  Outputs(r.Outputs),
-  Byproducts(r.Byproducts),
-  Depends(r.Depends),
-  CommandLines(r.CommandLines),
-  HaveComment(r.HaveComment),
-  Comment(r.Comment),
-  WorkingDirectory(r.WorkingDirectory),
-  EscapeAllowMakeVars(r.EscapeAllowMakeVars),
-  EscapeOldStyle(r.EscapeOldStyle),
-  Backtrace(r.Backtrace),
-  UsesTerminal(r.UsesTerminal)
-{
-}
-
-//----------------------------------------------------------------------------
-cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r)
-{
-  if(this == &r)
-    {
-    return *this;
-    }
-
-  this->Outputs = r.Outputs;
-  this->Byproducts= r.Byproducts;
-  this->Depends = r.Depends;
-  this->CommandLines = r.CommandLines;
-  this->HaveComment = r.HaveComment;
-  this->Comment = r.Comment;
-  this->WorkingDirectory = r.WorkingDirectory;
-  this->EscapeAllowMakeVars = r.EscapeAllowMakeVars;
-  this->EscapeOldStyle = r.EscapeOldStyle;
-  this->ImplicitDepends = r.ImplicitDepends;
-  this->Backtrace = r.Backtrace;
-  this->UsesTerminal = r.UsesTerminal;
-
-  return *this;
-}
-
 //----------------------------------------------------------------------------
 cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
                                  const std::vector<std::string>& outputs,
@@ -77,26 +37,19 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
   Byproducts(byproducts),
   Depends(depends),
   CommandLines(commandLines),
-  HaveComment(comment?true:false),
+  Backtrace(),
   Comment(comment?comment:""),
   WorkingDirectory(workingDirectory?workingDirectory:""),
+  HaveComment(comment?true:false),
   EscapeAllowMakeVars(false),
-  EscapeOldStyle(true),
-  Backtrace()
+  EscapeOldStyle(true)
 {
-  this->EscapeOldStyle = true;
-  this->EscapeAllowMakeVars = false;
   if(mf)
     {
     this->Backtrace = mf->GetBacktrace();
     }
 }
 
-//----------------------------------------------------------------------------
-cmCustomCommand::~cmCustomCommand()
-{
-}
-
 //----------------------------------------------------------------------------
 const std::vector<std::string>& cmCustomCommand::GetOutputs() const
 {

+ 3 - 7
Source/cmCustomCommand.h

@@ -26,8 +26,6 @@ class cmCustomCommand
 public:
   /** Default and copy constructors for STL containers.  */
   cmCustomCommand();
-  cmCustomCommand(const cmCustomCommand& r);
-  cmCustomCommand& operator=(cmCustomCommand const& r);
 
   /** Main constructor specifies all information for the command.  */
   cmCustomCommand(cmMakefile const* mf,
@@ -38,8 +36,6 @@ public:
                   const char* comment,
                   const char* workingDirectory);
 
-  ~cmCustomCommand();
-
   /** Get the output file produced by the command.  */
   const std::vector<std::string>& GetOutputs() const;
 
@@ -93,13 +89,13 @@ private:
   std::vector<std::string> Byproducts;
   std::vector<std::string> Depends;
   cmCustomCommandLines CommandLines;
-  bool HaveComment;
+  cmListFileBacktrace Backtrace;
+  ImplicitDependsList ImplicitDepends;
   std::string Comment;
   std::string WorkingDirectory;
+  bool HaveComment;
   bool EscapeAllowMakeVars;
   bool EscapeOldStyle;
-  cmListFileBacktrace Backtrace;
-  ImplicitDependsList ImplicitDepends;
   bool UsesTerminal;
 };
 

+ 5 - 3
Source/cmGetCMakePropertyCommand.cxx

@@ -51,9 +51,11 @@ bool cmGetCMakePropertyCommand
     }
   else
     {
-    const char *prop =
-      this->Makefile->GetState()
-          ->GetGlobalProperty(args[1]);
+    const char *prop = 0;
+    if (!args[1].empty())
+      {
+      prop = this->Makefile->GetState()->GetGlobalProperty(args[1]);
+      }
     if (prop)
       {
       output = prop;

+ 5 - 1
Source/cmGetDirectoryPropertyCommand.cxx

@@ -84,7 +84,11 @@ bool cmGetDirectoryPropertyCommand
     return true;
     }
 
-  const char *prop = dir->GetProperty(*i);
+  const char *prop = 0;
+  if (!i->empty())
+    {
+    prop = dir->GetProperty(*i);
+    }
   if (prop)
     {
     this->Makefile->AddDefinition(variable, prop);

+ 2 - 4
Source/cmGetPropertyCommand.cxx

@@ -142,8 +142,7 @@ bool cmGetPropertyCommand
     {
     // Lookup brief documentation.
     std::string output;
-    if(cmPropertyDefinition* def =
-       this->Makefile->GetState()->
+    if(cmPropertyDefinition const* def = this->Makefile->GetState()->
        GetPropertyDefinition(this->PropertyName, scope))
       {
       output = def->GetShortDescription();
@@ -158,8 +157,7 @@ bool cmGetPropertyCommand
     {
     // Lookup full documentation.
     std::string output;
-    if(cmPropertyDefinition* def =
-       this->Makefile->GetState()->
+    if(cmPropertyDefinition const* def = this->Makefile->GetState()->
        GetPropertyDefinition(this->PropertyName, scope))
       {
       output = def->GetFullDescription();

+ 5 - 1
Source/cmGetSourceFilePropertyCommand.cxx

@@ -38,7 +38,11 @@ bool cmGetSourceFilePropertyCommand
       this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
       return true;
       }
-    const char *prop = sf->GetPropertyForUser(args[2]);
+    const char *prop = 0;
+    if (!args[2].empty())
+      {
+      prop = sf->GetPropertyForUser(args[2]);
+      }
     if (prop)
       {
       this->Makefile->AddDefinition(var, prop);

+ 5 - 1
Source/cmGetTargetPropertyCommand.cxx

@@ -40,7 +40,11 @@ bool cmGetTargetPropertyCommand
   else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName))
     {
     cmTarget& target = *tgt;
-    const char* prop_cstr = target.GetProperty(args[2], this->Makefile);
+    const char* prop_cstr = 0;
+    if (!args[2].empty())
+      {
+      prop_cstr = target.GetProperty(args[2], this->Makefile);
+      }
     if(prop_cstr)
       {
       prop = prop_cstr;

+ 5 - 1
Source/cmGetTestPropertyCommand.cxx

@@ -29,7 +29,11 @@ bool cmGetTestPropertyCommand
   cmTest *test = this->Makefile->GetTest(testName);
   if (test)
     {
-    const char *prop = test->GetProperty(args[1]);
+    const char *prop = 0;
+    if (!args[1].empty())
+      {
+      prop = test->GetProperty(args[1]);
+      }
     if (prop)
       {
       this->Makefile->AddDefinition(var, prop);

+ 0 - 1
Source/cmGlobalGenerator.cxx

@@ -2438,7 +2438,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
 {
   // Package
   cmTarget target;
-  target.GetProperties().SetCMakeInstance(this->CMakeInstance);
   target.SetType(cmTarget::GLOBAL_TARGET, name);
   target.SetProperty("EXCLUDE_FROM_ALL","TRUE");
 

+ 8 - 6
Source/cmGlobalGenerator.h

@@ -398,10 +398,6 @@ protected:
     std::vector<std::string> depends, const char* workingDir,
     bool uses_terminal);
 
-  bool NeedSymbolicMark;
-  bool UseLinkScript;
-  bool ForceUnixPaths;
-  bool ToolSupportsColor;
   std::string FindMakeProgramFile;
   std::string ConfiguredFilesPath;
   cmake *CMakeInstance;
@@ -414,7 +410,6 @@ protected:
 
   // Set of named installation components requested by the project.
   std::set<std::string> InstallComponents;
-  bool InstallTargetEnabled;
   // Sets of named target exports
   cmExportSetMap ExportSets;
   std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets;
@@ -448,7 +443,6 @@ private:
                                                  cmState::Snapshot snapshot);
 
   cmMakefile* TryCompileOuterMakefile;
-  float FirstTimeProgress;
   // If you add a new map here, make sure it is copied
   // in EnableLanguagesFromGenerator
   std::map<std::string, bool> IgnoreExtensions;
@@ -521,6 +515,14 @@ private:
   // Pool of file locks
   cmFileLockPool FileLockPool;
 #endif
+
+protected:
+  float FirstTimeProgress;
+  bool NeedSymbolicMark;
+  bool UseLinkScript;
+  bool ForceUnixPaths;
+  bool ToolSupportsColor;
+  bool InstallTargetEnabled;
 };
 
 #endif

+ 1 - 1
Source/cmGraphVizWriter.cxx

@@ -48,6 +48,7 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
 ,GraphName("GG")
 ,GraphHeader("node [\n  fontsize = \"12\"\n];")
 ,GraphNodePrefix("node")
+,LocalGenerators(localGenerators)
 ,GenerateForExecutables(true)
 ,GenerateForStaticLibs(true)
 ,GenerateForSharedLibs(true)
@@ -55,7 +56,6 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
 ,GenerateForExternals(true)
 ,GeneratePerTarget(true)
 ,GenerateDependers(true)
-,LocalGenerators(localGenerators)
 ,HaveTargetsAndLibs(false)
 {
 }

+ 7 - 8
Source/cmGraphVizWriter.h

@@ -69,14 +69,6 @@ protected:
   std::string GraphHeader;
   std::string GraphNodePrefix;
 
-  bool GenerateForExecutables;
-  bool GenerateForStaticLibs;
-  bool GenerateForSharedLibs;
-  bool GenerateForModuleLibs;
-  bool GenerateForExternals;
-  bool GeneratePerTarget;
-  bool GenerateDependers;
-
   std::vector<cmsys::RegularExpression> TargetsToIgnoreRegex;
 
   const std::vector<cmLocalGenerator*>& LocalGenerators;
@@ -85,6 +77,13 @@ protected:
   // maps from the actual target names to node names in dot:
   std::map<std::string, std::string> TargetNamesNodes;
 
+  bool GenerateForExecutables;
+  bool GenerateForStaticLibs;
+  bool GenerateForSharedLibs;
+  bool GenerateForModuleLibs;
+  bool GenerateForExternals;
+  bool GeneratePerTarget;
+  bool GenerateDependers;
   bool HaveTargetsAndLibs;
 };
 

+ 4 - 2
Source/cmInstallFilesGenerator.cxx

@@ -28,9 +28,11 @@ cmInstallFilesGenerator
                           bool optional):
   cmInstallGenerator(dest, configurations, component, message),
   Makefile(mf),
-  Files(files), Programs(programs),
+  Files(files),
   FilePermissions(file_permissions),
-  Rename(rename), Optional(optional)
+  Rename(rename),
+  Programs(programs),
+  Optional(optional)
 {
   // We need per-config actions if any files have generator expressions.
   for(std::vector<std::string>::const_iterator i = files.begin();

+ 1 - 1
Source/cmInstallFilesGenerator.h

@@ -43,9 +43,9 @@ protected:
 
   cmMakefile* Makefile;
   std::vector<std::string> Files;
-  bool Programs;
   std::string FilePermissions;
   std::string Rename;
+  bool Programs;
   bool Optional;
 };
 

+ 3 - 1
Source/cmInstallTargetGenerator.cxx

@@ -29,7 +29,9 @@ cmInstallTargetGenerator
                            MessageLevel message,
                            bool optional):
   cmInstallGenerator(dest, configurations, component, message), Target(&t),
-  ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional)
+  FilePermissions(file_permissions),
+  ImportLibrary(implib),
+  Optional(optional)
 {
   this->ActionsPerConfig = true;
   this->NamelinkMode = NamelinkModeNone;

+ 2 - 4
Source/cmInstallTargetGenerator.h

@@ -14,7 +14,6 @@
 
 #include "cmInstallGenerator.h"
 #include "cmTarget.h"
-#include "cmGeneratorTarget.h"
 
 /** \class cmInstallTargetGenerator
  * \brief Generate target installation rules.
@@ -100,11 +99,10 @@ protected:
                      const std::string& toDestDirPath);
 
   cmTarget* Target;
-  bool ImportLibrary;
   std::string FilePermissions;
-  bool Optional;
   NamelinkModeType NamelinkMode;
-  cmGeneratorTarget* GeneratorTarget;
+  bool ImportLibrary;
+  bool Optional;
 };
 
 #endif

+ 7 - 16
Source/cmLocalUnixMakefileGenerator3.h

@@ -254,26 +254,10 @@ private:
 
   ImplicitDependTargetMap ImplicitDepends;
 
-  //==========================================================================
-  // Configuration settings.
-  int MakefileVariableSize;
   std::string ConfigurationName;
-  bool MakeCommandEscapeTargetTwice;
-  bool BorlandMakeCurlyHack;
-  //==========================================================================
 
   std::string HomeRelativeOutputPath;
 
-  /* Copy the setting of CMAKE_COLOR_MAKEFILE from the makefile at the
-     beginning of generation to avoid many duplicate lookups.  */
-  bool ColorMakefile;
-
-  /* Copy the setting of CMAKE_SKIP_PREPROCESSED_SOURCE_RULES and
-     CMAKE_SKIP_ASSEMBLY_SOURCE_RULES at the beginning of generation to
-     avoid many duplicate lookups.  */
-  bool SkipPreprocessedSourceRules;
-  bool SkipAssemblySourceRules;
-
   struct LocalObjectEntry
   {
     cmTarget* Target;
@@ -302,6 +286,13 @@ private:
   /* does the work for each target */
   std::map<std::string, std::string> MakeVariableMap;
   std::map<std::string, std::string> ShortMakeVariableMap;
+
+  int MakefileVariableSize;
+  bool MakeCommandEscapeTargetTwice;
+  bool BorlandMakeCurlyHack;
+  bool ColorMakefile;
+  bool SkipPreprocessedSourceRules;
+  bool SkipAssemblySourceRules;
 };
 
 #endif

+ 9 - 11
Source/cmMakefile.cxx

@@ -213,8 +213,6 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
   this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
 #endif
 
-  this->Properties.SetCMakeInstance(this->GetCMakeInstance());
-
   {
   const char* dir = this->GetCMakeInstance()->GetHomeDirectory();
   this->AddDefinition("CMAKE_SOURCE_DIR", dir);
@@ -4082,7 +4080,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
       }
     }
 
-  this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY);
+  this->Properties.SetProperty(prop, value);
 }
 
 void cmMakefile::AppendProperty(const std::string& prop,
@@ -4122,16 +4120,18 @@ void cmMakefile::AppendProperty(const std::string& prop,
     return;
     }
 
-  this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
+  this->Properties.AppendProperty(prop, value, asString);
 }
 
 const char *cmMakefile::GetProperty(const std::string& prop) const
 {
-  return this->GetProperty(prop, cmProperty::DIRECTORY);
+  const bool chain = this->GetState()->
+                  IsPropertyChained(prop, cmProperty::DIRECTORY);
+  return this->GetProperty(prop, chain);
 }
 
 const char *cmMakefile::GetProperty(const std::string& prop,
-                                    cmProperty::ScopeType scope) const
+                                    bool chain) const
 {
   // watch for specific properties
   static std::string output;
@@ -4235,15 +4235,13 @@ const char *cmMakefile::GetProperty(const std::string& prop,
     return output.c_str();
     }
 
-  bool chain = false;
-  const char *retVal =
-    this->Properties.GetPropertyValue(prop, scope, chain);
-  if (chain)
+  const char *retVal = this->Properties.GetPropertyValue(prop);
+  if (!retVal && chain)
     {
     if(this->LocalGenerator->GetParent())
       {
       return this->LocalGenerator->GetParent()->GetMakefile()->
-        GetProperty(prop, scope);
+        GetProperty(prop, chain);
       }
     return this->GetState()->GetGlobalProperty(prop);
     }

+ 8 - 11
Source/cmMakefile.h

@@ -372,8 +372,6 @@ public:
   };
   friend class PolicyPushPop;
 
-  mutable std::set<cmListFileContext> CMP0054ReportedIds;
-
   /**
    * Determine if the given context, name pair has already been reported
    * in context of CMP0054.
@@ -717,8 +715,7 @@ public:
   void AppendProperty(const std::string& prop, const char *value,
                       bool asString=false);
   const char *GetProperty(const std::string& prop) const;
-  const char *GetProperty(const std::string& prop,
-                          cmProperty::ScopeType scope) const;
+  const char *GetProperty(const std::string& prop, bool chain) const;
   bool GetPropertyAsBool(const std::string& prop) const;
 
   // Get the properties
@@ -848,6 +845,8 @@ protected:
   // Check for a an unused variable
   void LogUnused(const char* reason, const std::string& name) const;
 
+  mutable std::set<cmListFileContext> CMP0054ReportedIds;
+
   std::string ProjectName;    // project name
 
   // libraries, classes, and executables
@@ -949,10 +948,6 @@ private:
 
   cmPropertyMap Properties;
 
-  // Unused variable flags
-  bool WarnUnused;
-  bool CheckSystemVars;
-
   // stack of list files being read
   std::vector<std::string> ListFileStack;
 
@@ -994,8 +989,6 @@ private:
   cmPolicies::PolicyStatus
   GetPolicyStatusInternal(cmPolicies::PolicyID id) const;
 
-  bool CheckCMP0000;
-
   // Enforce rules about CMakeLists.txt files.
   void EnforceDirectoryLevelRules() const;
 
@@ -1021,7 +1014,6 @@ private:
                                   long line,
                                   bool removeEmpty,
                                   bool replaceAt) const;
-  bool Configured;
   /**
    * Old version of GetSourceFileWithOutput(const std::string&) kept for
    * backward-compatibility. It implements a linear search and support
@@ -1067,6 +1059,11 @@ private:
 
   void CheckForUnusedVariables() const;
 
+  // Unused variable flags
+  bool WarnUnused;
+  bool CheckSystemVars;
+  bool CheckCMP0000;
+  bool Configured;
   mutable bool SuppressWatches;
 };
 

+ 2 - 3
Source/cmOrderDirectories.h

@@ -44,8 +44,6 @@ private:
   cmTarget const* Target;
   std::string Purpose;
 
-  bool Computed;
-
   std::vector<std::string> OrderedDirectories;
 
   std::vector<cmOrderDirectoriesConstraint*> ConstraintEntries;
@@ -68,8 +66,9 @@ private:
   void OrderDirectories();
   void VisitDirectory(unsigned int i);
   void DiagnoseCycle();
-  bool CycleDiagnosed;
   int WalkId;
+  bool CycleDiagnosed;
+  bool Computed;
 
   // Adjacency-list representation of runtime path ordering graph.
   // This maps from directory to those that must come *before* it.

+ 17 - 16
Source/cmPolicies.cxx

@@ -343,29 +343,24 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
   return e.str();
 }
 
-cmPolicies::PolicyMap::PolicyMap()
-{
-  this->UNDEFINED.set();
-}
-
 cmPolicies::PolicyStatus
 cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
 {
   PolicyStatus status = cmPolicies::WARN;
 
-  if (this->OLD[id])
+  if (this->Status[(POLICY_STATUS_COUNT * id) + OLD])
     {
     status = cmPolicies::OLD;
     }
-  else if (this->NEW[id])
+  else if (this->Status[(POLICY_STATUS_COUNT * id) + NEW])
     {
     status = cmPolicies::NEW;
     }
-  else if (this->REQUIRED_ALWAYS[id])
+  else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS])
     {
     status = cmPolicies::REQUIRED_ALWAYS;
     }
-  else if (this->REQUIRED_IF_USED[id])
+  else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED])
     {
     status = cmPolicies::REQUIRED_IF_USED;
     }
@@ -375,19 +370,25 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
 void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id,
                                 cmPolicies::PolicyStatus status)
 {
-  this->UNDEFINED.reset(id);
-  this->OLD[id] = (status == cmPolicies::OLD);
-  this->NEW[id] = (status == cmPolicies::NEW);
-  this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS);
-  this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED);
+  this->Status[(POLICY_STATUS_COUNT * id) + OLD] = (status == OLD);
+  this->Status[(POLICY_STATUS_COUNT * id) + WARN] = (status == WARN);
+  this->Status[(POLICY_STATUS_COUNT * id) + NEW] = (status == NEW);
+  this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] =
+      (status == REQUIRED_ALWAYS);
+  this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED] =
+      (status == REQUIRED_IF_USED);
 }
 
 bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const
 {
-  return !this->UNDEFINED[id];
+  return this->Status[(POLICY_STATUS_COUNT * id) + OLD]
+      || this->Status[(POLICY_STATUS_COUNT * id) + WARN]
+      || this->Status[(POLICY_STATUS_COUNT * id) + NEW]
+      || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS]
+      || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED];
 }
 
 bool cmPolicies::PolicyMap::IsEmpty() const
 {
-  return !this->UNDEFINED.none();
+  return this->Status.none();
 }

+ 2 - 6
Source/cmPolicies.h

@@ -244,6 +244,7 @@ public:
     REQUIRED_IF_USED,
     REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
   };
+#define POLICY_STATUS_COUNT 5
 
   /// Policy identifiers
   enum PolicyID
@@ -281,18 +282,13 @@ public:
   /** Represent a set of policy values.  */
   struct PolicyMap
   {
-    PolicyMap();
     PolicyStatus Get(PolicyID id) const;
     void Set(PolicyID id, PolicyStatus status);
     bool IsDefined(PolicyID id) const;
     bool IsEmpty() const;
 
   private:
-    std::bitset<cmPolicies::CMPCOUNT> UNDEFINED;
-    std::bitset<cmPolicies::CMPCOUNT> OLD;
-    std::bitset<cmPolicies::CMPCOUNT> NEW;
-    std::bitset<cmPolicies::CMPCOUNT> REQUIRED_IF_USED;
-    std::bitset<cmPolicies::CMPCOUNT> REQUIRED_ALWAYS;
+    std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status;
   };
 };
 

+ 1 - 1
Source/cmProcessTools.cxx

@@ -44,7 +44,7 @@ void cmProcessTools::RunProcess(struct cmsysProcess_s* cp,
 
 //----------------------------------------------------------------------------
 cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR):
-  Separator(sep), IgnoreCR(ignoreCR), Log(0), Prefix(0), LineEnd('\0')
+   Log(0), Prefix(0), Separator(sep), LineEnd('\0'), IgnoreCR(ignoreCR)
 {
 }
 

+ 3 - 3
Source/cmProcessTools.h

@@ -51,12 +51,12 @@ public:
     /** Configure logging of lines as they are extracted.  */
     void SetLog(std::ostream* log, const char* prefix);
   protected:
-    char Separator;
-    bool IgnoreCR;
     std::ostream* Log;
     const char* Prefix;
-    char LineEnd;
     std::string Line;
+    char Separator;
+    char LineEnd;
+    bool IgnoreCR;
     virtual bool ProcessChunk(const char* data, int length);
 
     /** Implement in a subclass to process one line of input.  It

+ 2 - 5
Source/cmProperty.cxx

@@ -12,17 +12,14 @@
 #include "cmProperty.h"
 #include "cmSystemTools.h"
 
-void cmProperty::Set(const std::string& name, const char *value)
+void cmProperty::Set(const char *value)
 {
-  this->Name = name;
   this->Value = value;
   this->ValueHasBeenSet = true;
 }
 
-void cmProperty::Append(const std::string& name, const char *value,
-                        bool asString)
+void cmProperty::Append(const char *value, bool asString)
 {
-  this->Name = name;
   if(!this->Value.empty() && *value && !asString)
     {
     this->Value += ";";

+ 2 - 4
Source/cmProperty.h

@@ -21,11 +21,10 @@ public:
                    TEST, VARIABLE, CACHED_VARIABLE, INSTALL };
 
   // set this property
-  void Set(const std::string& name, const char *value);
+  void Set(const char *value);
 
   // append to this property
-  void Append(const std::string& name, const char *value,
-              bool asString = false);
+  void Append(const char *value, bool asString = false);
 
   // get the value
   const char *GetValue() const;
@@ -34,7 +33,6 @@ public:
   cmProperty() { this->ValueHasBeenSet = false; }
 
 protected:
-  std::string Name;
   std::string Value;
   bool ValueHasBeenSet;
 };

+ 4 - 4
Source/cmPropertyDefinitionMap.cxx

@@ -29,9 +29,9 @@ void cmPropertyDefinitionMap
     }
 }
 
-bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name)
+bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const
 {
-  cmPropertyDefinitionMap::iterator it = this->find(name);
+  cmPropertyDefinitionMap::const_iterator it = this->find(name);
   if (it == this->end())
     {
     return false;
@@ -40,9 +40,9 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name)
   return true;
 }
 
-bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name)
+bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const
 {
-  cmPropertyDefinitionMap::iterator it = this->find(name);
+  cmPropertyDefinitionMap::const_iterator it = this->find(name);
   if (it == this->end())
     {
     return false;

+ 2 - 2
Source/cmPropertyDefinitionMap.h

@@ -27,10 +27,10 @@ public:
                       bool chain);
 
   // has a named property been defined
-  bool IsPropertyDefined(const std::string& name);
+  bool IsPropertyDefined(const std::string& name) const;
 
   // is a named property set to chain
-  bool IsPropertyChained(const std::string& name);
+  bool IsPropertyChained(const std::string& name) const;
 };
 
 #endif

+ 8 - 21
Source/cmPropertyMap.cxx

@@ -14,6 +14,8 @@
 #include "cmake.h"
 #include "cmState.h"
 
+#include <assert.h>
+
 cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
 {
   cmPropertyMap::iterator it = this->find(name);
@@ -29,54 +31,39 @@ cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
   return prop;
 }
 
-void cmPropertyMap::SetProperty(const std::string& name, const char *value,
-                                cmProperty::ScopeType scope)
+void cmPropertyMap::SetProperty(const std::string& name, const char *value)
 {
   if(!value)
     {
     this->erase(name);
     return;
     }
-  (void)scope;
 
   cmProperty *prop = this->GetOrCreateProperty(name);
-  prop->Set(name,value);
+  prop->Set(value);
 }
 
 void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
-                                   cmProperty::ScopeType scope, bool asString)
+                                   bool asString)
 {
   // Skip if nothing to append.
   if(!value || !*value)
     {
     return;
     }
-  (void)scope;
 
   cmProperty *prop = this->GetOrCreateProperty(name);
-  prop->Append(name,value,asString);
+  prop->Append(value,asString);
 }
 
 const char *cmPropertyMap
-::GetPropertyValue(const std::string& name,
-                   cmProperty::ScopeType scope,
-                   bool &chain) const
+::GetPropertyValue(const std::string& name) const
 {
-  chain = false;
-  if (name.empty())
-    {
-    return 0;
-    }
+  assert(!name.empty());
 
   cmPropertyMap::const_iterator it = this->find(name);
   if (it == this->end())
     {
-    // should we chain up?
-    if (this->CMakeInstance)
-      {
-      chain = this->CMakeInstance->GetState()->
-                    IsPropertyChained(name,scope);
-      }
     return 0;
     }
   return it->second.GetValue();

+ 3 - 15
Source/cmPropertyMap.h

@@ -14,29 +14,17 @@
 
 #include "cmProperty.h"
 
-class cmake;
-
 class cmPropertyMap : public std::map<std::string,cmProperty>
 {
 public:
   cmProperty *GetOrCreateProperty(const std::string& name);
 
-  void SetProperty(const std::string& name, const char *value,
-                   cmProperty::ScopeType scope);
+  void SetProperty(const std::string& name, const char *value);
 
   void AppendProperty(const std::string& name, const char* value,
-                      cmProperty::ScopeType scope, bool asString=false);
-
-  const char *GetPropertyValue(const std::string& name,
-                               cmProperty::ScopeType scope,
-                               bool &chain) const;
-
-  void SetCMakeInstance(cmake *cm) { this->CMakeInstance = cm; }
-
-  cmPropertyMap() { this->CMakeInstance = 0;}
+                      bool asString=false);
 
-private:
-  cmake *CMakeInstance;
+  const char *GetPropertyValue(const std::string& name) const;
 };
 
 #endif

+ 1 - 2
Source/cmQtAutoGenerators.h

@@ -105,7 +105,6 @@ private:
   std::string SkipMoc;
   std::string SkipUic;
   std::string Headers;
-  bool IncludeProjectDirsBefore;
   std::string Srcdir;
   std::string Builddir;
   std::string MocExecutable;
@@ -131,6 +130,7 @@ private:
   std::map<std::string, std::string> RccOptions;
   std::map<std::string, std::vector<std::string> > RccInputs;
 
+  bool IncludeProjectDirsBefore;
   bool Verbose;
   bool ColorOutput;
   bool RunMocFailed;
@@ -138,7 +138,6 @@ private:
   bool RunRccFailed;
   bool GenerateAll;
   bool RelaxedMode;
-
 };
 
 #endif

+ 4 - 2
Source/cmSetTestsPropertiesCommand.cxx

@@ -85,8 +85,10 @@ bool cmSetTestsPropertiesCommand
     unsigned int k;
     for (k = 0; k < propertyPairs.size(); k = k + 2)
       {
-      test->SetProperty(propertyPairs[k],
-                        propertyPairs[k+1].c_str());
+      if (!propertyPairs[k].empty())
+        {
+        test->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str());
+        }
       }
     }
   else

+ 10 - 9
Source/cmSourceFile.cxx

@@ -22,7 +22,6 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name):
   Location(mf, name)
 {
   this->CustomCommand = 0;
-  this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
   this->FindFullPathFailed = false;
   this->IsUiFile = (".ui" ==
           cmSystemTools::GetFilenameLastExtension(this->Location.GetName()));
@@ -299,7 +298,7 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc)
 //----------------------------------------------------------------------------
 void cmSourceFile::SetProperty(const std::string& prop, const char* value)
 {
-  this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE);
+  this->Properties.SetProperty(prop, value);
 
   if (this->IsUiFile)
     {
@@ -315,8 +314,7 @@ void cmSourceFile::SetProperty(const std::string& prop, const char* value)
 void cmSourceFile::AppendProperty(const std::string& prop, const char* value,
                                   bool asString)
 {
-  this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE,
-                                  asString);
+  this->Properties.AppendProperty(prop, value, asString);
 }
 
 //----------------------------------------------------------------------------
@@ -362,13 +360,16 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
       }
     }
 
-  bool chain = false;
-  const char *retVal =
-    this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain);
-  if (chain)
+  const char *retVal = this->Properties.GetPropertyValue(prop);
+  if (!retVal)
     {
     cmMakefile const* mf = this->Location.GetMakefile();
-    return mf->GetProperty(prop,cmProperty::SOURCE_FILE);
+    const bool chain = mf->GetState()->
+                      IsPropertyChained(prop, cmProperty::SOURCE_FILE);
+    if (chain)
+      {
+      return mf->GetProperty(prop, chain);
+      }
     }
 
   return retVal;

+ 2 - 2
Source/cmSourceFile.h

@@ -107,8 +107,9 @@ private:
   std::string Extension;
   std::string Language;
   std::string FullPath;
-  bool FindFullPathFailed;
   std::string ObjectLibrary;
+  std::vector<std::string> Depends;
+  bool FindFullPathFailed;
   bool IsUiFile;
 
   bool FindFullPath(std::string* error);
@@ -116,7 +117,6 @@ private:
   void CheckExtension();
   void CheckLanguage(std::string const& ext);
 
-  std::vector<std::string> Depends;
 
   static const std::string propLANGUAGE;
 };

+ 24 - 13
Source/cmState.cxx

@@ -259,27 +259,41 @@ void cmState::DefineProperty(const std::string& name,
                                                   chained);
 }
 
-cmPropertyDefinition *cmState
+cmPropertyDefinition const* cmState
 ::GetPropertyDefinition(const std::string& name,
-                        cmProperty::ScopeType scope)
+                        cmProperty::ScopeType scope) const
 {
   if (this->IsPropertyDefined(name,scope))
     {
-    return &(this->PropertyDefinitions[scope][name]);
+    cmPropertyDefinitionMap const& defs =
+        this->PropertyDefinitions.find(scope)->second;
+    return &defs.find(name)->second;
     }
   return 0;
 }
 
 bool cmState::IsPropertyDefined(const std::string& name,
-                              cmProperty::ScopeType scope)
+                                cmProperty::ScopeType scope) const
 {
-  return this->PropertyDefinitions[scope].IsPropertyDefined(name);
+  std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it
+      = this->PropertyDefinitions.find(scope);
+  if (it == this->PropertyDefinitions.end())
+    {
+    return false;
+    }
+  return it->second.IsPropertyDefined(name);
 }
 
 bool cmState::IsPropertyChained(const std::string& name,
-                              cmProperty::ScopeType scope)
+                                cmProperty::ScopeType scope) const
 {
-  return this->PropertyDefinitions[scope].IsPropertyChained(name);
+  std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it
+      = this->PropertyDefinitions.find(scope);
+  if (it == this->PropertyDefinitions.end())
+    {
+    return false;
+    }
+  return it->second.IsPropertyChained(name);
 }
 
 void cmState::SetLanguageEnabled(std::string const& l)
@@ -427,14 +441,13 @@ void cmState::RemoveUserDefinedCommands()
 
 void cmState::SetGlobalProperty(const std::string& prop, const char* value)
 {
-  this->GlobalProperties.SetProperty(prop, value, cmProperty::GLOBAL);
+  this->GlobalProperties.SetProperty(prop, value);
 }
 
 void cmState::AppendGlobalProperty(const std::string& prop,
                                    const char* value, bool asString)
 {
-  this->GlobalProperties.AppendProperty(prop, value,
-                                        cmProperty::GLOBAL, asString);
+  this->GlobalProperties.AppendProperty(prop, value, asString);
 }
 
 const char *cmState::GetGlobalProperty(const std::string& prop)
@@ -472,9 +485,7 @@ const char *cmState::GetGlobalProperty(const std::string& prop)
     return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1;
     }
 #undef STRING_LIST_ELEMENT
-  bool dummy = false;
-  return this->GlobalProperties.GetPropertyValue(prop, cmProperty::GLOBAL,
-                                                 dummy);
+  return this->GlobalProperties.GetPropertyValue(prop);
 }
 
 bool cmState::GetGlobalPropertyAsBool(const std::string& prop)

+ 6 - 4
Source/cmState.h

@@ -111,12 +111,14 @@ public:
                       bool chain = false);
 
   // get property definition
-  cmPropertyDefinition *GetPropertyDefinition
-  (const std::string& name, cmProperty::ScopeType scope);
+  cmPropertyDefinition const* GetPropertyDefinition
+  (const std::string& name, cmProperty::ScopeType scope) const;
 
   // Is a property defined?
-  bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope);
-  bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope);
+  bool IsPropertyDefined(const std::string& name,
+                         cmProperty::ScopeType scope) const;
+  bool IsPropertyChained(const std::string& name,
+                         cmProperty::ScopeType scope) const;
 
   void SetLanguageEnabled(std::string const& l);
   bool GetLanguageEnabled(std::string const& l) const;

+ 25 - 44
Source/cmTarget.cxx

@@ -239,13 +239,6 @@ cmTargetInternals::~cmTargetInternals()
 //----------------------------------------------------------------------------
 cmTarget::cmTarget()
 {
-#define INITIALIZE_TARGET_POLICY_MEMBER(POLICY) \
-  this->PolicyStatus ## POLICY = cmPolicies::WARN;
-
-  CM_FOR_EACH_TARGET_POLICY(INITIALIZE_TARGET_POLICY_MEMBER)
-
-#undef INITIALIZE_TARGET_POLICY_MEMBER
-
   this->Makefile = 0;
 #if defined(_WIN32) && !defined(__CYGWIN__)
   this->LinkLibrariesForVS6Analyzed = false;
@@ -286,9 +279,6 @@ void cmTarget::SetMakefile(cmMakefile* mf)
   // Set our makefile.
   this->Makefile = mf;
 
-  // set the cmake instance of the properties
-  this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
-
   // Check whether this is a DLL platform.
   this->DLLPlatform = (this->Makefile->IsOn("WIN32") ||
                        this->Makefile->IsOn("CYGWIN") ||
@@ -443,20 +433,14 @@ void cmTarget::SetMakefile(cmMakefile* mf)
     }
 
   // Record current policies for later use.
-#define CAPTURE_TARGET_POLICY(POLICY) \
-  this->PolicyStatus ## POLICY = \
-    this->Makefile->GetPolicyStatus(cmPolicies::POLICY);
-
-  CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY)
-
-#undef CAPTURE_TARGET_POLICY
+  this->Makefile->RecordPolicies(this->PolicyMap);
 
   if (this->TargetTypeValue == INTERFACE_LIBRARY)
     {
     // This policy is checked in a few conditions. The properties relevant
     // to the policy are always ignored for INTERFACE_LIBRARY targets,
     // so ensure that the conditions don't lead to nonsense.
-    this->PolicyStatusCMP0022 = cmPolicies::NEW;
+    this->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW);
     }
 
   if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY)
@@ -1772,7 +1756,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
     }
   else
     {
-    this->Properties.SetProperty(prop, value, cmProperty::TARGET);
+    this->Properties.SetProperty(prop, value);
     this->MaybeInvalidatePropertyCache(prop);
     }
 }
@@ -1857,7 +1841,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
     }
   else
     {
-    this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
+    this->Properties.AppendProperty(prop, value, asString);
     this->MaybeInvalidatePropertyCache(prop);
     }
 }
@@ -2910,8 +2894,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
       // cannot take into account the per-configuration name of the
       // target because the configuration type may not be known at
       // CMake time.
-      this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild(),
-                                   cmProperty::TARGET);
+      this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild());
       }
 
     // Support "LOCATION_<CONFIG>".
@@ -2922,9 +2905,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
         return 0;
         }
       const char* configName = prop.c_str() + 9;
-      this->Properties.SetProperty(prop,
-                                   this->GetLocation(configName),
-                                   cmProperty::TARGET);
+      this->Properties.SetProperty(prop, this->GetLocation(configName));
       }
     // Support "<CONFIG>_LOCATION".
     else if(cmHasLiteralSuffix(prop, "_LOCATION"))
@@ -2936,9 +2917,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
           {
           return 0;
           }
-        this->Properties.SetProperty(prop,
-                                     this->GetLocation(configName),
-                                     cmProperty::TARGET);
+        this->Properties.SetProperty(prop, this->GetLocation(configName));
         }
       }
     }
@@ -3140,17 +3119,19 @@ const char *cmTarget::GetProperty(const std::string& prop,
             }
           }
         }
-      this->Properties.SetProperty("SOURCES", ss.str().c_str(),
-                                   cmProperty::TARGET);
+      this->Properties.SetProperty("SOURCES", ss.str().c_str());
       }
     }
 
-  bool chain = false;
-  const char *retVal =
-    this->Properties.GetPropertyValue(prop, cmProperty::TARGET, chain);
-  if (chain)
+  const char *retVal = this->Properties.GetPropertyValue(prop);
+  if (!retVal)
     {
-    return this->Makefile->GetProperty(prop, cmProperty::TARGET);
+    const bool chain = this->GetMakefile()->GetState()->
+                      IsPropertyChained(prop, cmProperty::TARGET);
+    if (chain)
+      {
+      return this->Makefile->GetProperty(prop, chain);
+      }
     }
   return retVal;
 }
@@ -5903,8 +5884,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
   // libraries and executables that export symbols.
   const char* explicitLibraries = 0;
   std::string linkIfaceProp;
-  if(thisTarget->PolicyStatusCMP0022 != cmPolicies::OLD &&
-     thisTarget->PolicyStatusCMP0022 != cmPolicies::WARN)
+  if(thisTarget->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
+     thisTarget->GetPolicyStatusCMP0022() != cmPolicies::WARN)
     {
     // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
     linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
@@ -5930,7 +5911,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
     }
 
   if(explicitLibraries &&
-     thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN &&
+     thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
      !this->PolicyWarnedCMP0022)
     {
     // Compare the explicitly set old link interface properties to the
@@ -5974,8 +5955,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
                                 iface.Libraries,
                                 iface.HadHeadSensitiveCondition);
     }
-  else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN
-        || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD)
+  else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN
+        || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD)
     // If CMP0022 is NEW then the plain tll signature sets the
     // INTERFACE_LINK_LIBRARIES, so if we get here then the project
     // cleared the property explicitly and we should not fall back
@@ -5986,7 +5967,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
       thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget);
     iface.Libraries.insert(iface.Libraries.end(),
                            impl->Libraries.begin(), impl->Libraries.end());
-    if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN &&
+    if(thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
        !this->PolicyWarnedCMP0022 && !usage_requirements_only)
       {
       // Compare the link implementation fallback link interface to the
@@ -6078,8 +6059,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
         }
       }
     }
-  else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN
-        || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD)
+  else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN
+        || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD)
     {
     // The link implementation is the default link interface.
     cmTarget::LinkImplementationLibraries const*
@@ -6399,7 +6380,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
   if(lib != item)
     {
     cmake* cm = this->Makefile->GetCMakeInstance();
-    switch(this->PolicyStatusCMP0004)
+    switch(this->GetPolicyStatusCMP0004())
       {
       case cmPolicies::WARN:
         {

+ 24 - 37
Source/cmTarget.h

@@ -144,7 +144,7 @@ public:
 
 #define DECLARE_TARGET_POLICY(POLICY) \
   cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
-    { return this->PolicyStatus ## POLICY; }
+    { return this->PolicyMap.Get(cmPolicies::POLICY); }
 
   CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
 
@@ -637,12 +637,6 @@ public:
 private:
   bool HandleLocationPropertyPolicy(cmMakefile* context) const;
 
-  // The set of include directories that are marked as system include
-  // directories.
-  std::set<std::string> SystemIncludeDirectories;
-
-  std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands;
-
 #if defined(_WIN32) && !defined(__CYGWIN__)
   /**
    * A list of direct dependencies. Use in conjunction with DependencyMap.
@@ -737,40 +731,48 @@ private:
   void GetSourceFiles(std::vector<std::string> &files,
                       const std::string& config) const;
 private:
+  mutable cmPropertyMap Properties;
+  std::set<std::string> SystemIncludeDirectories;
+  std::set<std::string> LinkDirectoriesEmmitted;
+  std::set<std::string> Utilities;
+  mutable std::set<std::string> LinkImplicitNullProperties;
+  std::map<std::string, cmListFileBacktrace> UtilityBacktraces;
+  mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
+  mutable std::map<std::string, std::string> MaxLanguageStandards;
+  cmPolicies::PolicyMap PolicyMap;
   std::string Name;
+  std::string InstallPath;
+  std::string RuntimeInstallPath;
+  mutable std::string ExportMacro;
+  std::vector<std::string> LinkDirectories;
   std::vector<cmCustomCommand> PreBuildCommands;
   std::vector<cmCustomCommand> PreLinkCommands;
   std::vector<cmCustomCommand> PostBuildCommands;
-  TargetType TargetTypeValue;
+  std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands;
   LinkLibraryVectorType PrevLinkedLibraries;
+  LinkLibraryVectorType OriginalLinkLibraries;
 #if defined(_WIN32) && !defined(__CYGWIN__)
   LinkLibraryVectorType LinkLibrariesForVS6;
-  bool LinkLibrariesForVS6Analyzed;
 #endif
-  std::vector<std::string> LinkDirectories;
-  std::set<std::string> LinkDirectoriesEmmitted;
+  cmMakefile* Makefile;
+  cmTargetInternalPointer Internal;
+  TargetType TargetTypeValue;
   bool HaveInstallRule;
-  std::string InstallPath;
-  std::string RuntimeInstallPath;
-  mutable std::string ExportMacro;
-  std::set<std::string> Utilities;
-  std::map<std::string, cmListFileBacktrace> UtilityBacktraces;
   bool RecordDependencies;
-  mutable cmPropertyMap Properties;
-  LinkLibraryVectorType OriginalLinkLibraries;
   bool DLLPlatform;
   bool IsAndroid;
   bool IsApple;
   bool IsImportedTarget;
+  bool BuildInterfaceIncludesAppended;
   mutable bool DebugIncludesDone;
-  mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
   mutable bool DebugCompileOptionsDone;
   mutable bool DebugCompileDefinitionsDone;
   mutable bool DebugSourcesDone;
   mutable bool DebugCompileFeaturesDone;
-  mutable std::set<std::string> LinkImplicitNullProperties;
-  mutable std::map<std::string, std::string> MaxLanguageStandards;
-  bool BuildInterfaceIncludesAppended;
+  mutable bool LinkImplementationLanguageIsContextDependent;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  bool LinkLibrariesForVS6Analyzed;
+#endif
 
   // Cache target output paths for each configuration.
   struct OutputInfo;
@@ -820,23 +822,10 @@ private:
 
   void ProcessSourceExpression(std::string const& expr);
 
-  // The cmMakefile instance that owns this target.  This should
-  // always be set.
-  cmMakefile* Makefile;
-
-  // Policy status recorded when target was created.
-#define TARGET_POLICY_MEMBER(POLICY) \
-  cmPolicies::PolicyStatus PolicyStatus ## POLICY;
-
-  CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_MEMBER)
-
-#undef TARGET_POLICY_MEMBER
-
   // Internal representation details.
   friend class cmTargetInternals;
   friend class cmGeneratorTarget;
   friend class cmTargetTraceDependencies;
-  cmTargetInternalPointer Internal;
 
   void ComputeVersionedName(std::string& vName,
                             std::string const& prefix,
@@ -844,8 +833,6 @@ private:
                             std::string const& suffix,
                             std::string const& name,
                             const char* version) const;
-
-  mutable bool LinkImplementationLanguageIsContextDependent;
 };
 
 #ifdef CMAKE_BUILD_WITH_CMAKE

+ 10 - 8
Source/cmTest.cxx

@@ -21,7 +21,6 @@ cmTest::cmTest(cmMakefile* mf)
 {
   this->Makefile = mf;
   this->OldStyle = true;
-  this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
 }
 
 //----------------------------------------------------------------------------
@@ -50,12 +49,15 @@ void cmTest::SetCommand(std::vector<std::string> const& command)
 //----------------------------------------------------------------------------
 const char *cmTest::GetProperty(const std::string& prop) const
 {
-  bool chain = false;
-  const char *retVal =
-    this->Properties.GetPropertyValue(prop, cmProperty::TEST, chain);
-  if (chain)
+  const char *retVal = this->Properties.GetPropertyValue(prop);
+  if (!retVal)
     {
-    return this->Makefile->GetProperty(prop,cmProperty::TEST);
+    const bool chain = this->Makefile->GetState()->
+          IsPropertyChained(prop, cmProperty::TEST);
+    if (chain)
+      {
+      return this->Makefile->GetProperty(prop, chain);
+      }
     }
   return retVal;
 }
@@ -69,12 +71,12 @@ bool cmTest::GetPropertyAsBool(const std::string& prop) const
 //----------------------------------------------------------------------------
 void cmTest::SetProperty(const std::string& prop, const char* value)
 {
-  this->Properties.SetProperty(prop, value, cmProperty::TEST);
+  this->Properties.SetProperty(prop, value);
 }
 
 //----------------------------------------------------------------------------
 void cmTest::AppendProperty(const std::string& prop,
                             const char* value, bool asString)
 {
-  this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString);
+  this->Properties.AppendProperty(prop, value, asString);
 }