In some build configurations, the target we depend on is not available for declaring the build dependency.
We only need to declare the build dependency, if the build target is available in the same build.
Should fix the issue raised in https://reviews.llvm.org/D107156#2969862
This patch should go into release/13 together with D108404
If the patch is accepted, please go ahead and commit - I might not be available for the next week.