cmList: Fix performance regression in Join / to_string

Refactoring in commit 45f17e5a85 (cmList: Add container conversion to
string, 2023-06-20) accidentally introduced unnecessary string copies
and allocations. Remove unnecessary copies.
1 file changed