cmGeneratorTarget: store synthetic targets in its cache
The synthetic target cache was never actually updated, so record them in the cache so that reuses can actually be discovered.
Fixes: #25568 (closed)
Manual-backport: release-3.28
Backport: release
Edited by Ben Boeckel