Fix OLD behavior of CMP0021.

Exclude Ninja and Xcode from the CMP0021 test

They do not behave the same as the makefile generator with
relative paths.

Don't overwrite the header file for in-source builds.
Merge topic 'fix-OLD-CMP0021' into next

eef6df5 Fix OLD behavior of CMP0021.