cmGeneratorExpressionNode: Fix short-circuit logic

Fix logic added by commit 634079b86d (cmGeneratorExpressionEvaluator:
Short-circuit boolean operators, 2023-09-11, v3.28.0-rc1~47^2) and
add missing test cases.

Fixes: #25412
This commit is contained in:
Martin Duffy
2023-11-12 20:01:30 -05:00
committed by Brad King
parent d36d2b9253
commit 27244a8f73
3 changed files with 6 additions and 1 deletions

View File

@@ -131,7 +131,7 @@ struct BooleanOpNode : public cmGeneratorExpressionNode
bool ShouldEvaluateNextParameter(const std::vector<std::string>& parameters,
std::string& def_value) const override
{
if (!parameters.empty() && parameters[0] == failureVal) {
if (!parameters.empty() && parameters.back() == failureVal) {
def_value = failureVal;
return false;
}

View File

@@ -1,4 +1,7 @@
set(error $<0>)
add_custom_target(check ALL COMMAND check
$<AND:0,${error}>
$<AND:0,1,${error}>
$<AND:1,0,${error}>
$<AND:0,0,${error}>
)

View File

@@ -1,4 +1,6 @@
set(error $<0>)
add_custom_target(check ALL COMMAND check
$<OR:1,${error}>
$<OR:0,1,${error}>
$<OR:1,0,${error}>
)