Why does TARGET_FILE_DIR create a dependency on the target

This behavior is a side effect of the current implementation. This genex shares the implementation with $<TARGET_FILE:...> which, with reason, add a dependency on the target.

The dependency is also added for $<TARGET_FILE_NAME:...>. For these two genex, I agree with you, It seems a bit curious. But adding a dependency ensure, for your example, that the directory exist when your command is executed.

1 Like