Make subclasses responsible for joining content.

This way we can add handling of relative/absolute paths and of
-D in compile definitions.
This commit is contained in:
Stephen Kelly
2013-01-29 17:23:31 +01:00
parent f6b16d4b06
commit 7bf490e9bb
11 changed files with 89 additions and 18 deletions
+25 -2
View File
@@ -37,9 +37,32 @@ void cmTargetCompileDefinitionsCommand
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
//----------------------------------------------------------------------------
std::string cmTargetCompileDefinitionsCommand
::Join(const std::vector<std::string> &content)
{
std::string defs;
std::string sep;
for(std::vector<std::string>::const_iterator it = content.begin();
it != content.end(); ++it)
{
if (strncmp(it->c_str(), "-D", 2) == 0)
{
defs += sep + it->substr(2);
}
else
{
defs += sep + *it;
}
sep = ";";
}
return defs;
}
//----------------------------------------------------------------------------
void cmTargetCompileDefinitionsCommand
::HandleDirectContent(cmTarget *tgt, const std::string &content,
::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
bool)
{
tgt->AppendProperty("COMPILE_DEFINITIONS", content.c_str());
tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content).c_str());
}