It isn’t supposed to. See the GENEX_EVAL expression.
This is not typical usage. The LINK_LIBRARIES of a target are meant to be private. Use just
target_link_libraries(test_ext PUBLIC lib_a)
This looks like a x-y problem. Please describe what you are really trying to do, perhaps in a new topic dedicated to your use case rather than the genex error.
Thanks for the information. Even after reading the linked documentation it’s not easy to understand how generator expressions are evaluated.
I discovered this problem by adding:
target_link_libraries(lib_a
PUBLIC
$<1:lib_b>
)
It took me a while to realise that the build failed because someone had used in a completely different place (scope was actually PRIVATE and not PUBLIC as in my first message):
I agree that this is not typical usage and I don’t understand why it was used in this case. But there it was and it made the build fail. Luckily I can modify that part of the code too and remove this redundant generator expression. It would be nice if CMake could detect this kind of errors and print a useful error message instead of creating invalid build.ninja file.