diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2015-04-29 17:25:13 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-30 10:21:19 -0400 |
commit | aed6239e40e7046c3f32e018d9c360ad0f624336 (patch) | |
tree | 704a638d740870f5c2c94d56d09e5f9b8a240472 /Source/cmConditionEvaluator.cxx | |
parent | 32a2f41402d38e1c5be3547bd042328df0b28124 (diff) | |
download | cmake-aed6239e40e7046c3f32e018d9c360ad0f624336.tar.gz |
if: Implement new IN_LIST operator
Diffstat (limited to 'Source/cmConditionEvaluator.cxx')
-rw-r--r-- | Source/cmConditionEvaluator.cxx | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 0a71c60a67..1f9b9d4b2d 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -15,7 +15,8 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile): Makefile(makefile), Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012)), - Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054)) + Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054)), + Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)) { } @@ -676,6 +677,41 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs, reducible, arg, newArgs, argP1, argP2); } + if (argP1 != newArgs.end() && argP2 != newArgs.end() && + this->IsKeyword("IN_LIST", *argP1)) + { + if(this->Policy57Status != cmPolicies::OLD && + this->Policy57Status != cmPolicies::WARN) + { + bool result = false; + + def = this->GetVariableOrString(*arg); + def2 = this->Makefile.GetDefinition(argP2->GetValue()); + + if(def2) + { + std::vector<std::string> list; + cmSystemTools::ExpandListArgument(def2, list, true); + + result = std::find(list.begin(), list.end(), def) != list.end(); + } + + this->HandleBinaryOp(result, + reducible, arg, newArgs, argP1, argP2); + } + else if(this->Policy57Status == cmPolicies::WARN) + { + std::ostringstream e; + e << (this->Makefile.GetPolicies()->GetPolicyWarning( + cmPolicies::CMP0057)) << "\n"; + e << "IN_LIST will be interpreted as an operator " + "when the policy is set to NEW. " + "Since the policy is not set the OLD behavior will be used."; + + this->Makefile.IssueMessage(cmake::AUTHOR_WARNING, e.str()); + } + } + ++arg; } } |