[Cmake-commits] CMake branch, next, updated. v2.8.11.2-2997-gb34a516

Stephen Kelly steveire at gmail.com
Tue Jul 9 16:49:58 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  b34a516a34d7e65f087feb4ecee80b4f43eab714 (commit)
       via  ac89a78289ff62d81ea6c56e5f750c34d30b7637 (commit)
      from  db9ca5115aa1cb09d91ecd8d160dd5025241ea87 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b34a516a34d7e65f087feb4ecee80b4f43eab714
commit b34a516a34d7e65f087feb4ecee80b4f43eab714
Merge: db9ca51 ac89a78
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jul 9 16:49:54 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jul 9 16:49:54 2013 -0400

    Merge topic 'compile-defs-debugging' into next
    
    ac89a78 Revert topic compile-defs-debugging.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac89a78289ff62d81ea6c56e5f750c34d30b7637
commit ac89a78289ff62d81ea6c56e5f750c34d30b7637
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jul 9 22:48:51 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Jul 9 22:49:13 2013 +0200

    Revert topic compile-defs-debugging.

diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index dfbb1c0..f6f4cef 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -621,15 +621,19 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
                                   ->GetGeneratorTarget(target);
 
     // the compilerdefines for this target
-    std::vector<std::string> cdefs;
-    target->GetCompileDefinitions(cdefs, buildType);
+    std::string cdefs = target->GetCompileDefinitions(buildType);
 
-    // Expand the list.
-    for(std::vector<std::string>::const_iterator di = cdefs.begin();
-        di != cdefs.end(); ++di)
+    if(!cdefs.empty())
       {
-      cmXMLSafe safedef(di->c_str());
-      fout <<"            <Add option=\"-D" << safedef.str() << "\" />\n";
+      // Expand the list.
+      std::vector<std::string> defs;
+      cmSystemTools::ExpandListArgument(cdefs.c_str(), defs);
+      for(std::vector<std::string>::const_iterator di = defs.begin();
+          di != defs.end(); ++di)
+        {
+        cmXMLSafe safedef(di->c_str());
+        fout <<"            <Add option=\"-D" << safedef.str() << "\" />\n";
+        }
       }
 
     // the include directories for this target
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index b0003c9..012013c 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -463,9 +463,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
     }
 
   // Add preprocessor definitions for this target and configuration.
-  std::vector<std::string> targetDefs;
-  target->GetCompileDefinitions(targetDefs, config);
-  lg->AppendDefines(defines, targetDefs);
+  lg->AppendDefines(defines, target->GetCompileDefinitions(config));
   lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS"));
   {
   std::string defPropName = "COMPILE_DEFINITIONS_";
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0022605..ad74767 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1121,9 +1121,8 @@ void cmGlobalGenerator::CreateGeneratorTargets()
     cmGeneratorTargetsType generatorTargets;
 
     cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
-
-    const std::vector<cmValueWithOrigin> noconfig_compile_definitions =
-                                mf->GetCompileDefinitionsEntries();
+    const char *noconfig_compile_definitions =
+                                      mf->GetProperty("COMPILE_DEFINITIONS");
 
     std::vector<std::string> configs;
     mf->GetConfigurations(configs);
@@ -1135,13 +1134,7 @@ void cmGlobalGenerator::CreateGeneratorTargets()
       cmTarget* t = &ti->second;
 
       {
-      for (std::vector<cmValueWithOrigin>::const_iterator it
-                                      = noconfig_compile_definitions.begin();
-          it != noconfig_compile_definitions.end(); ++it)
-        {
-        t->InsertCompileDefinition(*it);
-        }
-
+      t->AppendProperty("COMPILE_DEFINITIONS", noconfig_compile_definitions);
       for(std::vector<std::string>::const_iterator ci = configs.begin();
           ci != configs.end(); ++ci)
         {
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 63de1a5..9cfbe42 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1741,9 +1741,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     this->AppendDefines(ppDefs, exportMacro);
     }
   cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
-  std::vector<std::string> targetDefines;
-  target.GetCompileDefinitions(targetDefines, configName);
-  this->AppendDefines(ppDefs, targetDefines);
+  this->AppendDefines(ppDefs,
+                      target.GetCompileDefinitions(configName).c_str());
   buildSettings->AddAttribute
     ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 70d7d16..00846d5 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2301,13 +2301,7 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
   // Expand the list of definitions.
   std::vector<std::string> defines_vec;
   cmSystemTools::ExpandListArgument(defines_list, defines_vec);
-  this->AppendDefines(defines, defines_vec);
-}
 
-//----------------------------------------------------------------------------
-void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
-                                  const std::vector<std::string> &defines_vec)
-{
   for(std::vector<std::string>::const_iterator di = defines_vec.begin();
       di != defines_vec.end(); ++di)
     {
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f5cd7fd..f35ef8e 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -166,9 +166,6 @@ public:
   {
     this->AppendDefines(defines, defines_list.c_str());
   }
-  void AppendDefines(std::set<std::string>& defines,
-                     const std::vector<std::string> &defines_vec);
-
   /**
    * Join a set of defines into a definesString with a space separator.
    */
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index a8a7419..78a70f8 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1962,10 +1962,8 @@ void cmLocalUnixMakefileGenerator3
 
   // Build a list of preprocessor definitions for the target.
   std::set<std::string> defines;
-  std::vector<std::string> targetDefines;
-  target.GetCompileDefinitions(targetDefines,
-                               this->ConfigurationName.c_str());
-  this->AppendDefines(defines, targetDefines);
+  this->AppendDefines(defines, target.GetCompileDefinitions(
+                                            this->ConfigurationName.c_str()));
   if(!defines.empty())
     {
     cmakefileStream
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 6421cf6..0b61e1d 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1701,31 +1701,21 @@ void cmLocalVisualStudio6Generator
     std::set<std::string> minsizeDefinesSet;
     std::set<std::string> debugrelDefinesSet;
 
-    {
-    std::vector<std::string> targetDefines;
-    target.GetCompileDefinitions(targetDefines, 0);
-    this->AppendDefines(definesSet, targetDefines);
-    }
-    {
-    std::vector<std::string> targetDefines;
-    target.GetCompileDefinitions(targetDefines, "DEBUG");
-    this->AppendDefines(debugDefinesSet, targetDefines);
-    }
-    {
-    std::vector<std::string> targetDefines;
-    target.GetCompileDefinitions(targetDefines, "RELEASE");
-    this->AppendDefines(releaseDefinesSet, targetDefines);
-    }
-    {
-    std::vector<std::string> targetDefines;
-    target.GetCompileDefinitions(targetDefines, "MINSIZEREL");
-    this->AppendDefines(minsizeDefinesSet, targetDefines);
-    }
-    {
-    std::vector<std::string> targetDefines;
-    target.GetCompileDefinitions(targetDefines, "RELWITHDEBINFO");
-    this->AppendDefines(debugrelDefinesSet, targetDefines);
-    }
+    this->AppendDefines(
+      definesSet,
+      target.GetCompileDefinitions(0));
+    this->AppendDefines(
+      debugDefinesSet,
+      target.GetCompileDefinitions("DEBUG"));
+    this->AppendDefines(
+      releaseDefinesSet,
+      target.GetCompileDefinitions("RELEASE"));
+    this->AppendDefines(
+      minsizeDefinesSet,
+      target.GetCompileDefinitions("MINSIZEREL"));
+    this->AppendDefines(
+      debugrelDefinesSet,
+      target.GetCompileDefinitions("RELWITHDEBINFO"));
 
     std::string defines = " ";
     std::string debugDefines = " ";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 6b31c91..1d2f709 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -746,19 +746,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
   targetOptions.ParseFinish();
   cmGeneratorTarget* gt =
     this->GlobalGenerator->GetGeneratorTarget(&target);
-  std::vector<std::string> targetDefines;
-  target.GetCompileDefinitions(targetDefines, configName);
-  std::string targetDefinesString = "";
-  const char *sep = "";
-  for(std::vector<std::string>::const_iterator defIt = targetDefines.begin();
-      defIt != targetDefines.end();
-      ++defIt)
-    {
-    targetDefinesString += sep;
-    sep = ";";
-    targetDefinesString += *defIt;
-    }
-  targetOptions.AddDefines(targetDefinesString.c_str());
+  targetOptions.AddDefines(target.GetCompileDefinitions(configName).c_str());
   targetOptions.SetVerboseMakefile(
     this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
 
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index d94c93d..f3a66ba 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1505,12 +1505,6 @@ void cmMakefile::InitializeFromParent()
                                      parentOptions.begin(),
                                      parentOptions.end());
 
-  const std::vector<cmValueWithOrigin> parentDefines =
-                                      parent->GetCompileDefinitionsEntries();
-  this->CompileDefinitionsEntries.insert(this->CompileDefinitionsEntries.end(),
-                                     parentDefines.begin(),
-                                     parentDefines.end());
-
   this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
 
   // define flags
@@ -3499,19 +3493,6 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
     this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt));
     return;
     }
-  if (propname == "COMPILE_DEFINITIONS")
-    {
-    this->CompileDefinitionsEntries.clear();
-    if (!value)
-      {
-      return;
-      }
-    cmListFileBacktrace lfbt;
-    this->GetBacktrace(lfbt);
-    cmValueWithOrigin entry(value, lfbt);
-    this->CompileDefinitionsEntries.push_back(entry);
-    return;
-    }
 
   if ( propname == "INCLUDE_REGULAR_EXPRESSION" )
     {
@@ -3559,14 +3540,6 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
                                         cmValueWithOrigin(value, lfbt));
     return;
     }
-  if (propname == "COMPILE_DEFINITIONS")
-    {
-    cmListFileBacktrace lfbt;
-    this->GetBacktrace(lfbt);
-    this->CompileDefinitionsEntries.push_back(
-                                        cmValueWithOrigin(value, lfbt));
-    return;
-    }
   if ( propname == "LINK_DIRECTORIES" )
     {
     std::vector<std::string> varArgsExpanded;
@@ -3706,20 +3679,6 @@ const char *cmMakefile::GetProperty(const char* prop,
       }
     return output.c_str();
     }
-  else if (!strcmp("COMPILE_DEFINITIONS",prop))
-    {
-    std::string sep;
-    for (std::vector<cmValueWithOrigin>::const_iterator
-        it = this->CompileDefinitionsEntries.begin(),
-        end = this->CompileDefinitionsEntries.end();
-        it != end; ++it)
-      {
-      output += sep;
-      output += it->Value;
-      sep = ";";
-      }
-    return output.c_str();
-    }
 
   bool chain = false;
   const char *retVal =
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1b10773..4297155 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -871,10 +871,6 @@ public:
   {
     return this->CompileOptionsEntries;
   }
-  std::vector<cmValueWithOrigin> GetCompileDefinitionsEntries() const
-  {
-    return this->CompileDefinitionsEntries;
-  }
 
   bool IsGeneratingBuildSystem(){ return this->GeneratingBuildSystem; }
   void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; }
@@ -929,7 +925,6 @@ protected:
 
   std::vector<cmValueWithOrigin> IncludeDirectoriesEntries;
   std::vector<cmValueWithOrigin> CompileOptionsEntries;
-  std::vector<cmValueWithOrigin> CompileDefinitionsEntries;
 
   // Track the value of the computed DEFINITIONS property.
   void AddDefineFlag(const char*, std::string&);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index fa09cb7..1492dfa 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -309,10 +309,9 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
       }
 
     // Add preprocessor definitions for this target and configuration.
-    std::vector<std::string> targetDefines;
-    this->Target->GetCompileDefinitions(targetDefines,
-                            this->LocalGenerator->ConfigurationName.c_str());
-    this->LocalGenerator->AppendDefines(defines, targetDefines);
+    this->LocalGenerator->AppendDefines
+      (defines, this->Target->GetCompileDefinitions(
+                            this->LocalGenerator->ConfigurationName.c_str()));
 
     std::string definesString;
     this->LocalGenerator->JoinDefines(defines, definesString, lang);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c447235..65173ca 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -201,9 +201,9 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
     }
 
   // Add preprocessor definitions for this target and configuration.
-  std::vector<std::string> targetDefines;
-  this->Target->GetCompileDefinitions(targetDefines, this->GetConfigName());
-  this->LocalGenerator->AppendDefines(defines, targetDefines);
+  this->LocalGenerator->AppendDefines
+    (defines,
+     this->Target->GetCompileDefinitions(this->GetConfigName()));
   this->LocalGenerator->AppendDefines
     (defines,
      source->GetProperty("COMPILE_DEFINITIONS"));
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 2a7df86..34b3c7e 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -175,19 +175,15 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target,
     incs += *incDirIt;
     }
 
-  std::set<std::string> defines;
-  std::vector<std::string> targetDefines;
-  target->GetCompileDefinitions(targetDefines, config);
-  localGen->AppendDefines(defines, targetDefines);
+  defs = target->GetCompileDefinitions(config);
 
+  const char *tmp = makefile->GetProperty("COMPILE_DEFINITIONS");
   sep = "";
-  for(std::set<std::string>::const_iterator defIt = defines.begin();
-      defIt != defines.end();
-      ++defIt)
+  if (tmp)
     {
     defs += sep;
     sep = ";";
-    defs += *defIt;
+    defs += tmp;
     }
 }
 
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 2972720..a90fa74 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -141,15 +141,13 @@ public:
   };
   std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
   std::vector<TargetPropertyEntry*> CompileOptionsEntries;
-  std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
   std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
 
   std::map<std::string, std::vector<TargetPropertyEntry*> >
                                 CachedLinkInterfaceIncludeDirectoriesEntries;
   std::map<std::string, std::vector<TargetPropertyEntry*> >
                                 CachedLinkInterfaceCompileOptionsEntries;
-  std::map<std::string, std::vector<TargetPropertyEntry*> >
-                                CachedLinkInterfaceCompileDefinitionsEntries;
+  std::map<std::string, std::string> CachedLinkInterfaceCompileDefinitions;
 
   std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
   std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
@@ -188,7 +186,6 @@ cmTargetInternals::~cmTargetInternals()
 {
   deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries);
   deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries);
-  deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries);
 }
 
 //----------------------------------------------------------------------------
@@ -2848,17 +2845,6 @@ void cmTarget::SetProperty(const char* prop, const char* value)
                           new cmTargetInternals::TargetPropertyEntry(cge));
     return;
     }
-  if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
-    {
-    cmListFileBacktrace lfbt;
-    this->Makefile->GetBacktrace(lfbt);
-    cmGeneratorExpression ge(lfbt);
-    deleteAndClear(this->Internal->CompileDefinitionsEntries);
-    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
-    this->Internal->CompileDefinitionsEntries.push_back(
-                          new cmTargetInternals::TargetPropertyEntry(cge));
-    return;
-    }
   if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
     {
     cmOStringStream e;
@@ -2910,15 +2896,6 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
               new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
     return;
     }
-  if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
-    {
-    cmListFileBacktrace lfbt;
-    this->Makefile->GetBacktrace(lfbt);
-    cmGeneratorExpression ge(lfbt);
-    this->Internal->CompileDefinitionsEntries.push_back(
-              new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
-    return;
-    }
   if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
     {
     cmOStringStream e;
@@ -3023,20 +3000,6 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry,
 }
 
 //----------------------------------------------------------------------------
-void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry,
-                     bool before)
-{
-  cmGeneratorExpression ge(entry.Backtrace);
-
-  std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
-                = before ? this->Internal->CompileDefinitionsEntries.begin()
-                         : this->Internal->CompileDefinitionsEntries.end();
-
-  this->Internal->CompileDefinitionsEntries.insert(position,
-      new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
-}
-
-//----------------------------------------------------------------------------
 static void processIncludeDirectories(cmTarget *tgt,
       const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
       std::vector<std::string> &includes,
@@ -3268,12 +3231,12 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
 }
 
 //----------------------------------------------------------------------------
-static void processCompileOptionsInternal(cmTarget *tgt,
+static void processCompileOptions(cmTarget *tgt,
       const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
       std::vector<std::string> &options,
       std::set<std::string> &uniqueOptions,
       cmGeneratorExpressionDAGChecker *dagChecker,
-      const char *config, bool debugOptions, const char *logName)
+      const char *config, bool debugOptions)
 {
   cmMakefile *mf = tgt->GetMakefile();
 
@@ -3318,8 +3281,7 @@ static void processCompileOptionsInternal(cmTarget *tgt,
     if (!usedOptions.empty())
       {
       mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
-                            std::string("Used compile ") + logName
-                            + std::string(" for target ")
+                            std::string("Used compile options for target ")
                             + tgt->GetName() + ":\n"
                             + usedOptions, (*it)->ge->GetBacktrace());
       }
@@ -3327,19 +3289,6 @@ static void processCompileOptionsInternal(cmTarget *tgt,
 }
 
 //----------------------------------------------------------------------------
-static void processCompileOptions(cmTarget *tgt,
-      const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
-      std::vector<std::string> &options,
-      std::set<std::string> &uniqueOptions,
-      cmGeneratorExpressionDAGChecker *dagChecker,
-      const char *config, bool debugOptions)
-{
-  return processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
-                                       dagChecker, config, debugOptions,
-                                       "options");
-}
-
-//----------------------------------------------------------------------------
 void cmTarget::GetCompileOptions(std::vector<std::string> &result,
                                  const char *config)
 {
@@ -3435,56 +3384,8 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
 }
 
 //----------------------------------------------------------------------------
-static void processCompileDefinitions(cmTarget *tgt,
-      const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
-      std::vector<std::string> &options,
-      std::set<std::string> &uniqueOptions,
-      cmGeneratorExpressionDAGChecker *dagChecker,
-      const char *config, bool debugOptions)
+std::string cmTarget::GetCompileDefinitions(const char *config)
 {
-  return processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
-                                       dagChecker, config, debugOptions,
-                                       "definitions");
-}
-
-//----------------------------------------------------------------------------
-void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
-                                            const char *config)
-{
-  std::set<std::string> uniqueOptions;
-  cmListFileBacktrace lfbt;
-
-  cmGeneratorExpressionDAGChecker dagChecker(lfbt,
-                                              this->GetName(),
-                                              "COMPILE_DEFINITIONS", 0, 0);
-
-  std::vector<std::string> debugProperties;
-  const char *debugProp =
-              this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
-  if (debugProp)
-    {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
-    }
-
-  bool debugDefines = !this->DebugCompileDefinitionsDone
-                          && std::find(debugProperties.begin(),
-                                debugProperties.end(),
-                                "COMPILE_DEFINITIONS")
-                        != debugProperties.end();
-
-  if (this->Makefile->IsGeneratingBuildSystem())
-    {
-    this->DebugCompileDefinitionsDone = true;
-    }
-
-  processCompileDefinitions(this,
-                            this->Internal->CompileDefinitionsEntries,
-                            list,
-                            uniqueOptions,
-                            &dagChecker,
-                            config,
-                            debugDefines);
-
   const char *configProp = 0;
   if (config)
     {
@@ -3494,6 +3395,10 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
     }
 
   const char *noconfigProp = this->GetProperty("COMPILE_DEFINITIONS");
+  cmListFileBacktrace lfbt;
+  cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+                                            this->GetName(),
+                                            "COMPILE_DEFINITIONS", 0, 0);
 
   std::string defsString = (noconfigProp ? noconfigProp : "");
   if (configProp && noconfigProp)
@@ -3502,62 +3407,67 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
     }
   defsString += (configProp ? configProp : "");
 
-  std::string configString = config ? config : "";
-  if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
+  cmGeneratorExpression ge(lfbt);
+  std::string result = ge.Parse(defsString.c_str())->Evaluate(this->Makefile,
+                                config,
+                                false,
+                                this,
+                                &dagChecker);
+
+  std::vector<std::string> libs;
+  this->GetDirectLinkLibraries(config, libs, this);
+
+  if (libs.empty())
     {
-    for (std::vector<cmValueWithOrigin>::const_iterator
-        it = this->Internal->LinkInterfacePropertyEntries.begin(),
-        end = this->Internal->LinkInterfacePropertyEntries.end();
-        it != end; ++it)
-      {
-      {
-      cmGeneratorExpression ge(lfbt);
-      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
-                                                        ge.Parse(it->Value);
-      std::string targetResult = cge->Evaluate(this->Makefile, config,
-                                        false, this, 0, 0);
-      if (!this->Makefile->FindTargetToUse(targetResult.c_str()))
-        {
-        continue;
-        }
-      }
-      std::string defsGenex = "$<TARGET_PROPERTY:" +
-                              it->Value + ",INTERFACE_COMPILE_DEFINITIONS>";
-      if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
-        {
-        // Because it->Value is a generator expression, ensure that it
-        // evaluates to the non-empty string before being used in the
-        // TARGET_PROPERTY expression.
-        defsGenex = "$<$<BOOL:" + it->Value + ">:" + defsGenex + ">";
-        }
-      cmGeneratorExpression ge(it->Backtrace);
-      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
-                                                                defsGenex);
+    return result;
+    }
 
-      this->Internal
-        ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back(
-                        new cmTargetInternals::TargetPropertyEntry(cge,
-                                                              it->Value));
+  std::string sep;
+  std::string depString;
+  for (std::vector<std::string>::const_iterator it = libs.begin();
+      it != libs.end(); ++it)
+    {
+    if ((cmGeneratorExpression::IsValidTargetName(it->c_str())
+          || cmGeneratorExpression::Find(it->c_str()) != std::string::npos)
+        && this->Makefile->FindTargetToUse(it->c_str()))
+      {
+      depString += sep + "$<TARGET_PROPERTY:"
+                + *it + ",INTERFACE_COMPILE_DEFINITIONS>";
+      sep = ";";
       }
     }
 
-  processCompileDefinitions(this,
-    this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[configString],
-                            list,
-                            uniqueOptions,
-                            &dagChecker,
-                            config,
-                            debugDefines);
+  std::string configString = config ? config : "";
+  if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
+    {
+    cmGeneratorExpression ge2(lfbt);
+    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge2 =
+                                                        ge2.Parse(depString);
+    this->Internal->CachedLinkInterfaceCompileDefinitions[configString] =
+                                                cge2->Evaluate(this->Makefile,
+                                                               config,
+                                                               false,
+                                                               this,
+                                                               &dagChecker);
+    }
+  if (!this->Internal->CachedLinkInterfaceCompileDefinitions[configString]
+                                                                    .empty())
+    {
+    result += (result.empty() ? "" : ";")
+        + this->Internal->CachedLinkInterfaceCompileDefinitions[configString];
+    }
 
   if (!this->Makefile->IsGeneratingBuildSystem())
     {
-    deleteAndClear(this->Internal->CachedLinkInterfaceCompileDefinitionsEntries);
+    this->Internal->CachedLinkInterfaceCompileDefinitions[configString] = "";
     }
   else
     {
     this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString]
                                                                       = true;
     }
+
+  return result;
 }
 
 //----------------------------------------------------------------------------
@@ -3929,24 +3839,6 @@ const char *cmTarget::GetProperty(const char* prop,
       }
     return output.c_str();
     }
-  if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
-    {
-    static std::string output;
-    output = "";
-    std::string sep;
-    typedef cmTargetInternals::TargetPropertyEntry
-                                TargetPropertyEntry;
-    for (std::vector<TargetPropertyEntry*>::const_iterator
-        it = this->Internal->CompileDefinitionsEntries.begin(),
-        end = this->Internal->CompileDefinitionsEntries.end();
-        it != end; ++it)
-      {
-      output += sep;
-      output += (*it)->ge->GetInput();
-      sep = ";";
-      }
-    return output.c_str();
-    }
 
   if (strcmp(prop,"IMPORTED") == 0)
     {
@@ -6672,7 +6564,6 @@ cmTargetInternalPointer::~cmTargetInternalPointer()
 {
   deleteAndClear(this->Pointer->IncludeDirectoriesEntries);
   deleteAndClear(this->Pointer->CompileOptionsEntries);
-  deleteAndClear(this->Pointer->CompileDefinitionsEntries);
   delete this->Pointer;
 }
 
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index adaae47..3bc0ab2 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -442,8 +442,7 @@ public:
       If no macro should be defined null is returned.  */
   const char* GetExportMacro();
 
-  void GetCompileDefinitions(std::vector<std::string> &result,
-                             const char *config);
+  std::string GetCompileDefinitions(const char *config);
 
   // Compute the set of languages compiled by the target.  This is
   // computed every time it is called because the languages can change
@@ -514,8 +513,6 @@ public:
                      bool before = false);
   void InsertCompileOption(const cmValueWithOrigin &entry,
                      bool before = false);
-  void InsertCompileDefinition(const cmValueWithOrigin &entry,
-                     bool before = false);
 
   void AppendBuildInterfaceIncludes();
 
@@ -652,7 +649,6 @@ private:
   bool IsImportedTarget;
   bool DebugIncludesDone;
   bool DebugCompileOptionsDone;
-  bool DebugCompileDefinitionsDone;
   mutable std::set<std::string> LinkImplicitNullProperties;
   bool BuildInterfaceIncludesAppended;
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5881e03..50f195e 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1337,19 +1337,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
   clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
   clOptions.Parse(flags.c_str());
   clOptions.Parse(defineFlags.c_str());
-  std::vector<std::string> targetDefines;
-  this->Target->GetCompileDefinitions(targetDefines, configName.c_str());
-  std::string targetDefinesString = "";
-  const char *sep = "";
-  for(std::vector<std::string>::const_iterator defIt = targetDefines.begin();
-      defIt != targetDefines.end();
-      ++defIt)
-    {
-    targetDefinesString += sep;
-    sep = ";";
-    targetDefinesString += *defIt;
-    }
-  clOptions.AddDefines(targetDefinesString.c_str());
+  clOptions.AddDefines(this->Target->GetCompileDefinitions(
+                                                configName.c_str()).c_str());
   clOptions.SetVerboseMakefile(
     this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
 

-----------------------------------------------------------------------

Summary of changes:
 Source/cmExtraCodeBlocksGenerator.cxx      |   18 ++-
 Source/cmExtraSublimeTextGenerator.cxx     |    4 +-
 Source/cmGlobalGenerator.cxx               |   13 +--
 Source/cmGlobalXCodeGenerator.cxx          |    5 +-
 Source/cmLocalGenerator.cxx                |    6 -
 Source/cmLocalGenerator.h                  |    3 -
 Source/cmLocalUnixMakefileGenerator3.cxx   |    6 +-
 Source/cmLocalVisualStudio6Generator.cxx   |   40 ++---
 Source/cmLocalVisualStudio7Generator.cxx   |   14 +--
 Source/cmMakefile.cxx                      |   41 -----
 Source/cmMakefile.h                        |    5 -
 Source/cmMakefileTargetGenerator.cxx       |    7 +-
 Source/cmNinjaTargetGenerator.cxx          |    6 +-
 Source/cmQtAutomoc.cxx                     |   12 +-
 Source/cmTarget.cxx                        |  221 +++++++---------------------
 Source/cmTarget.h                          |    6 +-
 Source/cmVisualStudio10TargetGenerator.cxx |   15 +--
 17 files changed, 104 insertions(+), 318 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list