summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetCompileDefinitionsCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmTargetCompileDefinitionsCommand.cxx')
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx39
1 files changed, 25 insertions, 14 deletions
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index 492a1b7..7645833 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -20,13 +20,11 @@ bool cmTargetCompileDefinitionsCommand
}
void cmTargetCompileDefinitionsCommand
-::HandleImportedTargetInvalidScope(const std::string &scope,
- const std::string &tgt)
+::HandleImportedTarget(const std::string &tgt)
{
cmOStringStream e;
- e << "Cannot specify " << scope << " compile definitions for imported "
- "target \"" << tgt << "\". Compile definitions can only be "
- "specified for an imported target in the INTERFACE mode.";
+ e << "Cannot specify compile definitions for imported target \""
+ << tgt << "\".";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
@@ -39,19 +37,32 @@ void cmTargetCompileDefinitionsCommand
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
-bool cmTargetCompileDefinitionsCommand
-::HandleNonTargetArg(std::string &content,
- const std::string &sep,
- const std::string &entry,
- const std::string &)
+//----------------------------------------------------------------------------
+std::string cmTargetCompileDefinitionsCommand
+::Join(const std::vector<std::string> &content)
{
- content += sep + entry;
- return true;
+ 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());
}