[CMake][libclc] Improve dependencies to avoid build errors (#95018)

With the Makefile generator and particularly high build parallelism some
intermediate dependencies may be generated redundantly and concurrently,
leading to build failures.

To fix this, arrange for libclc's add_custom_commands to depend on
targets in addition to files.

This follows CMake documentation's[^1] guidance on add_custom_command:

> Do not list the output in more than one independent target that may
> build in parallel or the instances of the rule may conflict. Instead,
> use the add_custom_target() command to drive the command and make the
> other targets depend on that one.

Eliminating the redundant commands also improves build times.

[^1]: https://cmake.org/cmake/help/v3.29/command/add_custom_command.html

GitOrigin-RevId: 64796044f4152c49e4b3c797390a83dcfd33bd46
2 files changed