cmake: Warn about unnecessary paths on command line

We can't make it an error as that would break existing behavior.

Fixes: #23110
5 files changed