Instead of having an odd fake of it. Will help some required
refactorings and already showed some issues, fixed by this patch,
namely:
- don't use string(regex replace) to extract a string from another
string. in case it doesn't match it will offer the whole content which
is never what we want.
- messages(ERROR), the correct parameter is FATAL_ERROR, cmake
understands "ERROR" as mere output string
- turn the macro into a function, otherwise 2 calls in the same
subdirectory are dangerous.
CCBUG: 371562