summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetCompileDefinitionsCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-29 16:23:31 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-01-29 18:34:04 (GMT)
commit7bf490e9bb6128082aa178f28691b3fc418322fe (patch)
treea8f701d2db9a3960cceb1596705906c19ba42df4 /Source/cmTargetCompileDefinitionsCommand.cxx
parentf6b16d4b0642d26111cddff714b464e22b715482 (diff)
downloadCMake-7bf490e9bb6128082aa178f28691b3fc418322fe.zip
CMake-7bf490e9bb6128082aa178f28691b3fc418322fe.tar.gz
CMake-7bf490e9bb6128082aa178f28691b3fc418322fe.tar.bz2
Make subclasses responsible for joining content.
This way we can add handling of relative/absolute paths and of -D in compile definitions.
Diffstat (limited to 'Source/cmTargetCompileDefinitionsCommand.cxx')
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index 312d625..7645833 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -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());
}