$<0> genex doesn't evaluate argument, $<IF> evaluates both. Is that intentional?

I’ve been hit by a difference between $<0:x> and $<IF:c,x,y> which I considered unexpected, and wanted to ask whether it’s intentional.

In these example, assume target foo does not exist. Tested with CMake 3.18.3.

The following genex evaluates to the empty string just fine:

$<$<TARGET_EXISTS:foo>:$<TARGET_LINKER_FILE:foo>>

However, if we use $<IF> instead:

$<IF:$<TARGET_EXISTS:foo>,$<TARGET_LINKER_FILE:foo>,>

we get an error saying

No target “foo”

This means that both branches of $<IF> must be fully valid, regardless of the condition. From my view, it severly diminishes the usability of $<IF> if I have to think about whether the condition affects the validity of both branches, instead of using it automatically whenever I need an if-else.

Is this behaviour intentional, or should I file a bug?

Sounds like the same concern:
IF Generator expression evaluates both branches eagerly
https://gitlab.kitware.com/cmake/cmake/-/issues/21045

Yes, that’s the same issue. Thanks for finding the ticket.

So it seems the answer to “Is that intentional?” is “No, but it’s not practical to address.” Unfortunate, but understandable; I can live with that.