errors: avoid constructing a stream before getting the last error

Constructing a stream may involve operations that change the global
error state. Avoid the streams by using `cmStrCat` instead.
5 files changed