Fix regression in target output file naming logic
Refactoring in !2350 (merged) accidentally changed the logic for target artifact prefix and suffix names such that setting a PREFIX or SUFFIX target property would cause an empty value to be used. Revert that part of the change and use a simpler alternative. Add a test case.
The same MR also changed the treatment of the empty string in CMP0018 diagnostic logic. Restore the behavior.