find_*: ensure consistent behavior for cache variables

Fixes: #22121
29 files changed