Skip to content

cmGeneratorExpressionEvaluator: Short-circuit boolean operators

Martin Duffy requested to merge martin.duffy/cmake:genexp-no-eval into master

Short-circuit evaluation of IF, AND and OR generator expressions.

This reduces confusion and verbosity of some generator expression logic.

# Before
$<IF:$<IS_TARGET:${x}>,$<$<IS_TARGET:${x}>:$<TARGET_FILE:${x}>>,NO-TARGET>

# After
$<IF:$<IS_TARGET:${x}>,$<TARGET_FILE:${x}>,NO-TARGET>

The old behavior with the After example gives the following error when set(x test):

Error evaluating generator expression:
   $<TARGET_FILE:test>
No target "test"

Merge request reports