Commit 4cfa918a authored by Ben Boeckel's avatar Ben Boeckel Committed by Ben Boeckel
Browse files

cmTarget: Factor out common code

parent 85242b7d
......@@ -2993,6 +2993,22 @@ 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
{
......@@ -3077,19 +3093,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
static std::string output;
output = "";
std::string sep;
typedef cmTargetInternals::TargetPropertyEntry
TargetPropertyEntry;
for (std::vector<TargetPropertyEntry*>::const_iterator
it = this->Internal->IncludeDirectoriesEntries.begin(),
end = this->Internal->IncludeDirectoriesEntries.end();
it != end; ++it)
{
output += sep;
output += (*it)->ge->GetInput();
sep = ";";
}
MakePropertyList(output, this->Internal->IncludeDirectoriesEntries);
return output.c_str();
}
else if(prop == "COMPILE_OPTIONS")
......@@ -3100,19 +3104,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
static std::string output;
output = "";
std::string sep;
typedef cmTargetInternals::TargetPropertyEntry
TargetPropertyEntry;
for (std::vector<TargetPropertyEntry*>::const_iterator
it = this->Internal->CompileOptionsEntries.begin(),
end = this->Internal->CompileOptionsEntries.end();
it != end; ++it)
{
output += sep;
output += (*it)->ge->GetInput();
sep = ";";
}
MakePropertyList(output, this->Internal->CompileOptionsEntries);
return output.c_str();
}
else if(prop == "COMPILE_FEATURES")
......@@ -3123,19 +3115,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
static std::string output;
output = "";
std::string sep;
typedef cmTargetInternals::TargetPropertyEntry
TargetPropertyEntry;
for (std::vector<TargetPropertyEntry*>::const_iterator
it = this->Internal->CompileFeaturesEntries.begin(),
end = this->Internal->CompileFeaturesEntries.end();
it != end; ++it)
{
output += sep;
output += (*it)->ge->GetInput();
sep = ";";
}
MakePropertyList(output, this->Internal->CompileFeaturesEntries);
return output.c_str();
}
else if(prop == "COMPILE_DEFINITIONS")
......@@ -3146,19 +3126,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
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 = ";";
}
MakePropertyList(output, this->Internal->CompileDefinitionsEntries);
return output.c_str();
}
else if(prop == "LINK_LIBRARIES")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment