This adds an internal module CheckCXXLinkerFlag which could be used for #15934 (closed) but would need tests added before moving it to public modules. I'm unsure how to do that, so I'll leave that to others.
Fixes: #20076 (closed)
Backport: release:HEAD~1^2