cmake: When given multiple source paths use last instead of first
When given two source paths via -S
or just directory paths prefer
the last one. When the paths are mixed always prefer the last -S
entry.
Fixes: #23238 (closed)
Backport: release
Edited by Brad King