cmFindBase: skip writing `names` and `*_directories` when empty

When the arrays are empty, the YAML ends up with `foo:` which is
equivalent to `foo: null`, not `foo: []`. Avoid writing the key when it
has no information to provide.
1 file changed