CMP0171: Improve diagnostic context

When issuing the policy warning that `codegen` is a reserved target
name, use the diagnostic context in which the target was declared,
rather than the root context (which cannot be affected in script).
4 files changed