Port remaining code to GetCompileDefinitions().

This commit is contained in:
Stephen Kelly 2012-09-21 08:51:42 +02:00
parent f178d531a6
commit 0ff4e3f0b8
4 changed files with 18 additions and 36 deletions

View File

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

View File

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

View File

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

View File

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