diff options
Diffstat (limited to 'Source/cmTargetPropCommandBase.cxx')
-rw-r--r-- | Source/cmTargetPropCommandBase.cxx | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 771097c..287ce46 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -48,8 +48,20 @@ bool cmTargetPropCommandBase return false; } + bool system = false; unsigned int argIndex = 1; + if ((flags & PROCESS_SYSTEM) && args[argIndex] == "SYSTEM") + { + if (args.size() < 4) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + system = true; + ++argIndex; + } + bool prepend = false; if ((flags & PROCESS_BEFORE) && args[argIndex] == "BEFORE") { @@ -66,7 +78,7 @@ bool cmTargetPropCommandBase while (argIndex < args.size()) { - if (!this->ProcessContentArgs(args, argIndex, prepend)) + if (!this->ProcessContentArgs(args, argIndex, prepend, system)) { return false; } @@ -77,7 +89,7 @@ bool cmTargetPropCommandBase //---------------------------------------------------------------------------- bool cmTargetPropCommandBase ::ProcessContentArgs(std::vector<std::string> const& args, - unsigned int &argIndex, bool prepend) + unsigned int &argIndex, bool prepend, bool system) { const std::string scope = args[argIndex]; @@ -105,12 +117,12 @@ bool cmTargetPropCommandBase || args[i] == "PRIVATE" || args[i] == "INTERFACE" ) { - this->PopulateTargetProperies(scope, content, prepend); + this->PopulateTargetProperies(scope, content, prepend, system); return true; } content.push_back(args[i]); } - this->PopulateTargetProperies(scope, content, prepend); + this->PopulateTargetProperies(scope, content, prepend, system); return true; } @@ -118,27 +130,35 @@ bool cmTargetPropCommandBase void cmTargetPropCommandBase ::PopulateTargetProperies(const std::string &scope, const std::vector<std::string> &content, - bool prepend) + bool prepend, bool system) { if (scope == "PRIVATE" || scope == "PUBLIC") { - this->HandleDirectContent(this->Target, content, prepend); + this->HandleDirectContent(this->Target, content, prepend, system); } if (scope == "INTERFACE" || scope == "PUBLIC") { - if (prepend) - { - const std::string propName = std::string("INTERFACE_") + this->Property; - const char *propValue = this->Target->GetProperty(propName.c_str()); - const std::string totalContent = this->Join(content) + (propValue - ? std::string(";") + propValue - : std::string()); - this->Target->SetProperty(propName.c_str(), totalContent.c_str()); - } - else - { - this->Target->AppendProperty(("INTERFACE_" + this->Property).c_str(), - this->Join(content).c_str()); - } + this->HandleInterfaceContent(this->Target, content, prepend, system); + } +} + +//---------------------------------------------------------------------------- +void cmTargetPropCommandBase::HandleInterfaceContent(cmTarget *tgt, + const std::vector<std::string> &content, + bool prepend, bool) +{ + if (prepend) + { + const std::string propName = std::string("INTERFACE_") + this->Property; + const char *propValue = tgt->GetProperty(propName.c_str()); + const std::string totalContent = this->Join(content) + (propValue + ? std::string(";") + propValue + : std::string()); + tgt->SetProperty(propName.c_str(), totalContent.c_str()); + } + else + { + tgt->AppendProperty(("INTERFACE_" + this->Property).c_str(), + this->Join(content).c_str()); } } |