diff options
author | Brad King <brad.king@kitware.com> | 2023-11-14 14:07:01 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-11-14 14:07:10 (GMT) |
commit | baec1dac9bafd003879e40b7352ac2cfba0e25b0 (patch) | |
tree | becc27aa676f78d3375975549108c8a75f5b5169 | |
parent | c7c59a286287b79f2f90c0aeef1b592ee5cdb855 (diff) | |
parent | 27244a8f7385b97c38052495495a1e5aca11c485 (diff) | |
download | CMake-baec1dac9bafd003879e40b7352ac2cfba0e25b0.zip CMake-baec1dac9bafd003879e40b7352ac2cfba0e25b0.tar.gz CMake-baec1dac9bafd003879e40b7352ac2cfba0e25b0.tar.bz2 |
Merge topic 'genex-fix-short-circuit' into release-3.28
27244a8f73 cmGeneratorExpressionNode: Fix short-circuit logic
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8966
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 2 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 57beb72..c8147b2 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -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; } diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake index 26bcaba..1827343 100644 --- a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake @@ -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}> ) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake index b574937..db2fd52 100644 --- a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake @@ -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}> ) |