summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2014-02-08 10:27:24 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2014-07-16 21:28:32 (GMT)
commit4cfa918a9ae983274a7995ca89fb46fdf570b00c (patch)
tree51517cb1fdabfef720b8a25e9dc0128b6eb1c02f
parent85242b7df63a8097c5672c3053873aec371b6af7 (diff)
downloadCMake-4cfa918a9ae983274a7995ca89fb46fdf570b00c.zip
CMake-4cfa918a9ae983274a7995ca89fb46fdf570b00c.tar.gz
CMake-4cfa918a9ae983274a7995ca89fb46fdf570b00c.tar.bz2
cmTarget: Factor out common code
-rw-r--r--Source/cmTarget.cxx72
1 files changed, 20 insertions, 52 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 641ac41..8be14f3 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2994,6 +2994,22 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
}
//----------------------------------------------------------------------------
+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
{
return this->GetProperty(prop, this->Makefile);
@@ -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")