buildelement: Ensure command-subdir is part of the cache key

`command-subdir` was previously missing from the cache key. This patch
makes it a part of the cache key _if_ it was specified. It means that
the cache key will not change for elements that had not defined a
`command-subdir`. However, it will change for every element that did
define it.

Fixes #1295.
4 files changed