summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetCompileDefinitionsCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-01-30 14:38:52 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-01-30 14:38:52 (GMT)
commitda2b0245a380282892be8007f4c3d184a91bcfe0 (patch)
treeee9c9236f472bc2ec09f22b4c04854c0908cb019 /Source/cmTargetCompileDefinitionsCommand.cxx
parent7462a8a8c3417e559e54d6de7eef837e2adfd2e6 (diff)
parent7bf490e9bb6128082aa178f28691b3fc418322fe (diff)
downloadCMake-da2b0245a380282892be8007f4c3d184a91bcfe0.zip
CMake-da2b0245a380282892be8007f4c3d184a91bcfe0.tar.gz
CMake-da2b0245a380282892be8007f4c3d184a91bcfe0.tar.bz2
Merge topic 'fix-target-property-commands'
7bf490e Make subclasses responsible for joining content. f6b16d4 Don't allow targets args in the new target commands. b3a7e19 Make the Property name protected so that subclasses can use it.
Diffstat (limited to 'Source/cmTargetCompileDefinitionsCommand.cxx')
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx31
1 files changed, 22 insertions, 9 deletions
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index 683eff6..7645833 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -37,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());
}