diff options
author | Brad King <brad.king@kitware.com> | 2015-08-03 13:25:10 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-08-03 13:25:10 (GMT) |
commit | 7ac2b1256b09044b86c6bd926cc239133beab088 (patch) | |
tree | b45456f41ea1885955795ce3c65c6b29ce502884 /Source/cmConditionEvaluator.cxx | |
parent | 94d53d1664b1e792e8088880cfd206e8e81ff625 (diff) | |
parent | 14e49ed15615e7f2bcb58aa4540683250006f5c7 (diff) | |
download | CMake-7ac2b1256b09044b86c6bd926cc239133beab088.zip CMake-7ac2b1256b09044b86c6bd926cc239133beab088.tar.gz CMake-7ac2b1256b09044b86c6bd926cc239133beab088.tar.bz2 |
Merge topic 'if-test'
14e49ed1 if: Add "TEST <test>" condition
623dcc85 ExternalProject: Avoid if() auto-dereference of a "TEST" variable
Diffstat (limited to 'Source/cmConditionEvaluator.cxx')
-rw-r--r-- | Source/cmConditionEvaluator.cxx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 420bfdf..7874803 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -16,7 +16,8 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile): Makefile(makefile), Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012)), Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054)), - Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)) + Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)), + Policy64Status(makefile.GetPolicyStatus(cmPolicies::CMP0064)) { } @@ -493,6 +494,29 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, this->Makefile.FindTargetToUse(argP1->GetValue())?true:false, reducible, arg, newArgs, argP1, argP2); } + // does a test exist + if(this->Policy64Status != cmPolicies::OLD && + this->Policy64Status != cmPolicies::WARN) + { + if (this->IsKeyword("TEST", *arg) && argP1 != newArgs.end()) + { + const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str()); + this->HandlePredicate( + haveTest?true:false, + reducible, arg, newArgs, argP1, argP2); + } + } + else if(this->Policy64Status == cmPolicies::WARN && + this->IsKeyword("TEST", *arg)) + { + std::ostringstream e; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0064) << "\n"; + e << "TEST 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()); + } // is a variable defined if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) { |