cmTarget: Split storage of compile definitions from genexes.

This commit is contained in:
Stephen Kelly 2015-08-04 21:30:17 +02:00
parent 44e071aeff
commit 197f4de110
1 changed files with 19 additions and 32 deletions

View File

@ -177,7 +177,9 @@ public:
std::vector<std::string> CompileFeaturesEntries;
std::vector<cmListFileBacktrace> CompileFeaturesBacktraces;
std::vector<TargetPropertyEntry*> CompileFeaturesItems;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
std::vector<std::string> CompileDefinitionsEntries;
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
std::vector<TargetPropertyEntry*> CompileDefinitionsItems;
std::vector<TargetPropertyEntry*> SourceEntries;
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
@ -474,6 +476,11 @@ void cmTarget::Compute()
this->Internal->CompileFeaturesEntries,
this->Internal->CompileFeaturesBacktraces,
this->Internal->CompileFeaturesItems);
CreatePropertyGeneratorExpressions(
this->Internal->CompileDefinitionsEntries,
this->Internal->CompileDefinitionsBacktraces,
this->Internal->CompileDefinitionsItems);
}
//----------------------------------------------------------------------------
@ -1728,12 +1735,11 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
}
else if(prop == "COMPILE_DEFINITIONS")
{
this->Internal->CompileDefinitionsEntries.clear();
this->Internal->CompileDefinitionsBacktraces.clear();
this->Internal->CompileDefinitionsEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
deleteAndClear(this->Internal->CompileDefinitionsEntries);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(cge));
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
else if(prop == "EXPORT_NAME" && this->IsImported())
{
@ -1817,10 +1823,9 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
else if(prop == "COMPILE_DEFINITIONS")
{
this->Internal->CompileDefinitionsEntries.push_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
else if(prop == "EXPORT_NAME" && this->IsImported())
{
@ -1952,10 +1957,8 @@ void cmTarget::InsertCompileOption(std::string const& entry,
void cmTarget::InsertCompileDefinition(std::string const& entry,
cmListFileBacktrace const& bt)
{
cmGeneratorExpression ge(bt);
this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
this->Internal->CompileDefinitionsEntries.push_back(entry);
this->Internal->CompileDefinitionsBacktraces.push_back(bt);
}
//----------------------------------------------------------------------------
@ -2337,7 +2340,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
}
processCompileDefinitions(this,
this->Internal->CompileDefinitionsEntries,
this->Internal->CompileDefinitionsItems,
list,
uniqueOptions,
&dagChecker,
@ -2744,22 +2747,6 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
return messageType != cmake::FATAL_ERROR;
}
//----------------------------------------------------------------------------
static void MakePropertyList(std::string& output,
std::vector<cmTargetInternals::TargetPropertyEntry*> const& values)
{
output = "";
std::string sep;
for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
it = values.begin(), end = values.end();
it != end; ++it)
{
output += sep;
output += (*it)->ge->GetInput();
sep = ";";
}
}
//----------------------------------------------------------------------------
const char *cmTarget::GetProperty(const std::string& prop) const
{
@ -2968,7 +2955,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
static std::string output;
MakePropertyList(output, this->Internal->CompileDefinitionsEntries);
output = cmJoin(this->Internal->CompileDefinitionsEntries, ";");
return output.c_str();
}
else if (prop == propIMPORTED)
@ -4844,7 +4831,7 @@ cmTargetInternalPointer::~cmTargetInternalPointer()
cmDeleteAll(this->Pointer->IncludeDirectoriesItems);
cmDeleteAll(this->Pointer->CompileOptionsItems);
cmDeleteAll(this->Pointer->CompileFeaturesItems);
cmDeleteAll(this->Pointer->CompileDefinitionsEntries);
cmDeleteAll(this->Pointer->CompileDefinitionsItems);
cmDeleteAll(this->Pointer->SourceEntries);
delete this->Pointer;
}