diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-05-28 10:26:05 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2022-06-01 13:28:54 (GMT) |
commit | 4d1883df1142fbe5c23cb7f433f619c1a7322984 (patch) | |
tree | 6f066361f28b28e1700aa28d2aa78885bb136de6 /Source | |
parent | f3be15e4382c17d0441a4fa69f44482d888e9c9d (diff) | |
download | CMake-4d1883df1142fbe5c23cb7f433f619c1a7322984.zip CMake-4d1883df1142fbe5c23cb7f433f619c1a7322984.tar.gz CMake-4d1883df1142fbe5c23cb7f433f619c1a7322984.tar.bz2 |
Genex-PATH_EQUAL: path comparison
To complete issue #23498
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 52b771a..b08cddb 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1034,6 +1034,23 @@ static const struct PathNode : public cmGeneratorExpressionNode } } pathNode; +static const struct PathEqualNode : public cmGeneratorExpressionNode +{ + PathEqualNode() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return 2; } + + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* /*context*/, + const GeneratorExpressionContent* /*content*/, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + { + return cmCMakePath{ parameters[0] } == cmCMakePath{ parameters[1] } ? "1" + : "0"; + } +} pathEqualNode; + static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode { MakeCIdentifierNode() {} // NOLINT(modernize-use-equals-default) @@ -3265,6 +3282,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "LOWER_CASE", &lowerCaseNode }, { "UPPER_CASE", &upperCaseNode }, { "PATH", &pathNode }, + { "PATH_EQUAL", &pathEqualNode }, { "MAKE_C_IDENTIFIER", &makeCIdentifierNode }, { "BOOL", &boolNode }, { "IF", &ifNode }, |