cmNinjaTargetGenerator: ensure that the object output directory exists
If a target has no object compilations within it, nothing ensures that
the directory exists yet it is still mentioned as an order-only
dependency within the build files. While ninja is OK with this,
samu, an alternate ninja implementation, is not. Make sure the
directory always exists for consistency.
Also add a test case.
Fixes: #25526 (closed)
Maybe fine for %3.28.2?