summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-12-05 14:23:31 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-12-05 14:23:49 (GMT)
commitd101cb07ec732b3b9cdd29bda643ffae3f1e7d92 (patch)
tree569b7cdd68342465b07f3224b989b51c7a10736b /Source/cmCoreTryCompile.cxx
parent4139486a4ff5783f04f320f3aaad182833ad275f (diff)
parenta820877d033069062f2cac83d9e611d5af905d0a (diff)
downloadCMake-d101cb07ec732b3b9cdd29bda643ffae3f1e7d92.zip
CMake-d101cb07ec732b3b9cdd29bda643ffae3f1e7d92.tar.gz
CMake-d101cb07ec732b3b9cdd29bda643ffae3f1e7d92.tar.bz2
Merge topic 'cmFileCopier-error-loss'
a820877d03 errors: avoid constructing a stream before getting the last error 5cf7018af6 cmFileCopier: remember error statuses and get their strings 0639a32d3a cmFileTimes: return status codes from APIs Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9023
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index fa30b06..a4f36cc 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -629,13 +629,11 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
// now create a CMakeLists.txt file in that directory
FILE* fout = cmsys::SystemTools::Fopen(outFileName, "w");
if (!fout) {
- std::ostringstream e;
- /* clang-format off */
- e << "Failed to open\n"
- " " << outFileName << "\n"
- << cmSystemTools::GetLastSystemError();
- /* clang-format on */
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Failed to open\n"
+ " ",
+ outFileName, '\n', cmSystemTools::GetLastSystemError()));
return cm::nullopt;
}