Browse Source

Port remaining code to GetCompileDefinitions().

Stephen Kelly 13 năm trước cách đây
mục cha
commit
0ff4e3f0b8

+ 7 - 4
Source/cmExtraCodeBlocksGenerator.cxx

@@ -617,14 +617,17 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
           "         <Option compiler=\"" << compiler << "\" />\n"
           "         <Compiler>\n";
 
+    cmGeneratorTarget *gtgt = this->GlobalGenerator
+                                  ->GetGeneratorTarget(target);
+
     // the compilerdefines for this target
-    const char* cdefs = target->GetMakefile()->GetProperty(
-                                                        "COMPILE_DEFINITIONS");
-    if(cdefs)
+    std::string cdefs = gtgt->GetCompileDefinitions();
+
+    if(cdefs.empty())
       {
       // Expand the list.
       std::vector<std::string> defs;
-      cmSystemTools::ExpandListArgument(cdefs, defs);
+      cmSystemTools::ExpandListArgument(cdefs.c_str(), defs);
       for(std::vector<std::string>::const_iterator di = defs.begin();
           di != defs.end(); ++di)
         {

+ 4 - 12
Source/cmGlobalXCodeGenerator.cxx

@@ -1647,16 +1647,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
     // Add the export symbol definition for shared library objects.
     this->AppendDefines(ppDefs, exportMacro);
     }
-  this->AppendDefines
-    (ppDefs, this->CurrentMakefile->GetProperty("COMPILE_DEFINITIONS"));
-  this->AppendDefines(ppDefs, target.GetProperty("COMPILE_DEFINITIONS"));
+  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
+  this->AppendDefines(ppDefs, gtgt->GetCompileDefinitions());
   if(configName)
     {
-    std::string defVarName = "COMPILE_DEFINITIONS_";
-    defVarName += cmSystemTools::UpperCase(configName);
-    this->AppendDefines
-      (ppDefs, this->CurrentMakefile->GetProperty(defVarName.c_str()));
-    this->AppendDefines(ppDefs, target.GetProperty(defVarName.c_str()));
+    this->AppendDefines(ppDefs, gtgt->GetCompileDefinitions(configName));
     }
   buildSettings->AddAttribute
     ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
@@ -1713,10 +1708,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
 
   // Set target-specific architectures.
   std::vector<std::string> archs;
-  {
-  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
   gtgt->GetAppleArchs(configName, archs);
-  }
+
   if(!archs.empty())
     {
     // Enable ARCHS attribute.
@@ -1953,7 +1946,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
   BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
   BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
   std::vector<std::string> includes;
-  cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
   this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt);
   std::set<cmStdString> emitted;
   emitted.insert("/System/Library/Frameworks");

+ 4 - 11
Source/cmLocalVisualStudio7Generator.cxx

@@ -724,10 +724,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
     flags += targetFlags;
     }
 
-  std::string configUpper = cmSystemTools::UpperCase(configName);
-  std::string defPropName = "COMPILE_DEFINITIONS_";
-  defPropName += configUpper;
-
   // Get preprocessor definitions for this directory.
   std::string defineFlags = this->Makefile->GetDefineFlags();
   Options::Tool t = Options::Compiler;
@@ -744,11 +740,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
   targetOptions.Parse(flags.c_str());
   targetOptions.Parse(defineFlags.c_str());
   targetOptions.ParseFinish();
-  targetOptions.AddDefines
-    (this->Makefile->GetProperty("COMPILE_DEFINITIONS"));
-  targetOptions.AddDefines(target.GetProperty("COMPILE_DEFINITIONS"));
-  targetOptions.AddDefines(this->Makefile->GetProperty(defPropName.c_str()));
-  targetOptions.AddDefines(target.GetProperty(defPropName.c_str()));
+  cmGeneratorTarget* gt =
+    this->GlobalGenerator->GetGeneratorTarget(&target);
+  targetOptions.AddDefines(gt->GetCompileDefinitions());
+  targetOptions.AddDefines(gt->GetCompileDefinitions(configName));
   targetOptions.SetVerboseMakefile(
     this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
 
@@ -819,8 +814,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
   targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
   fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
   std::vector<std::string> includes;
-  cmGeneratorTarget* gt =
-    this->GlobalGenerator->GetGeneratorTarget(&target);
   this->GetIncludeDirectories(includes, gt);
   std::vector<std::string>::iterator i = includes.begin();
   for(;i != includes.end(); ++i)

+ 3 - 9
Source/cmVisualStudio10TargetGenerator.cxx

@@ -1225,21 +1225,15 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
     flags += " ";
     flags += targetFlags;
     }
-  std::string configUpper = cmSystemTools::UpperCase(configName);
-  std::string defPropName = "COMPILE_DEFINITIONS_";
-  defPropName += configUpper;
-
   // Get preprocessor definitions for this directory.
   std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags();
   clOptions.FixExceptionHandlingDefault();
   clOptions.AddFlag("PrecompiledHeader", "NotUsing");
   clOptions.Parse(flags.c_str());
   clOptions.Parse(defineFlags.c_str());
-  clOptions.AddDefines
-    (this->Makefile->GetProperty("COMPILE_DEFINITIONS"));
-  clOptions.AddDefines(this->Target->GetProperty("COMPILE_DEFINITIONS"));
-  clOptions.AddDefines(this->Makefile->GetProperty(defPropName.c_str()));
-  clOptions.AddDefines(this->Target->GetProperty(defPropName.c_str()));
+  clOptions.AddDefines(this->GeneratorTarget->GetCompileDefinitions());
+  clOptions.AddDefines(this->GeneratorTarget->GetCompileDefinitions(
+                                                        configName.c_str()));
   clOptions.SetVerboseMakefile(
     this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));