summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmConditionEvaluator.cxx26
-rw-r--r--Source/cmConditionEvaluator.h1
-rw-r--r--Source/cmPolicies.h6
3 files changed, 32 insertions, 1 deletions
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 141c4eb..5de012a 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -16,6 +16,7 @@
#include "cmsys/RegularExpression.hxx"
+#include "cmCMakePath.h"
#include "cmExpandedCommandArgument.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -58,6 +59,7 @@ auto const keyVERSION_GREATER = "VERSION_GREATER"_s;
auto const keyVERSION_GREATER_EQUAL = "VERSION_GREATER_EQUAL"_s;
auto const keyVERSION_LESS = "VERSION_LESS"_s;
auto const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL"_s;
+auto const keyPATH_EQUAL = "PATH_EQUAL"_s;
cmSystemTools::CompareOp const MATCH2CMPOP[5] = {
cmSystemTools::OP_LESS, cmSystemTools::OP_LESS_EQUAL,
@@ -217,6 +219,7 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile,
, Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054))
, Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057))
, Policy64Status(makefile.GetPolicyStatus(cmPolicies::CMP0064))
+ , Policy139Status(makefile.GetPolicyStatus(cmPolicies::CMP0139))
{
}
@@ -775,6 +778,29 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
this->Makefile.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
}
}
+
+ else if (this->IsKeyword(keyPATH_EQUAL, *args.next)) {
+
+ if (this->Policy139Status != cmPolicies::OLD &&
+ this->Policy139Status != cmPolicies::WARN) {
+
+ cmValue lhs = this->GetVariableOrString(*args.current);
+ cmValue rhs = this->GetVariableOrString(*args.nextnext);
+ const auto result = cmCMakePath{ *lhs } == cmCMakePath{ *rhs };
+ newArgs.ReduceTwoArgs(result, args);
+ }
+
+ else if (this->Policy139Status == cmPolicies::WARN) {
+ std::ostringstream e;
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0139)
+ << "\n"
+ "PATH_EQUAL 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(MessageType::AUTHOR_WARNING, e.str());
+ }
+ }
}
return true;
}
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index 37b7825..9486b16 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -79,4 +79,5 @@ private:
cmPolicies::PolicyStatus Policy54Status;
cmPolicies::PolicyStatus Policy57Status;
cmPolicies::PolicyStatus Policy64Status;
+ cmPolicies::PolicyStatus Policy139Status;
};
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index f13432b..256d483 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -417,7 +417,11 @@ class cmMakefile;
cmPolicies::WARN) \
SELECT(POLICY, CMP0138, \
"MSVC compilers use -ZI instead of /Zi for x86 and x64 by default.", \
- 3, 24, 0, cmPolicies::WARN)
+ 3, 24, 0, cmPolicies::WARN) \
+ SELECT( \
+ POLICY, CMP0139, \
+ "The if() command supports path comparisons using PATH_EQUAL operator.", \
+ 3, 24, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \