From 884c47754543c8462e097093925da5b4c142a819 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:30:48 -0400 Subject: cmCoreTryCompile: combine strings where possible --- Source/cmCoreTryCompile.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 9b67d7f..0a1ed30 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -555,10 +555,13 @@ cm::optional cmCoreTryCompile::TryCompileCode( testLangs.insert(lang); } else { std::ostringstream err; - err << "Unknown extension \"" << ext << "\" for file\n" - << " " << si << "\n" - << "try_compile() works only for enabled languages. " - << "Currently these are:\n "; + err << "Unknown extension \"" << ext + << "\" for file\n" + " " + << si + << "\n" + "try_compile() works only for enabled languages. " + "Currently these are:\n "; std::vector langs; gg->GetEnabledLanguages(langs); err << cmJoin(langs, " "); @@ -587,7 +590,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( std::ostringstream e; /* clang-format off */ e << "Failed to open\n" - << " " << outFileName << "\n" + " " << outFileName << "\n" << cmSystemTools::GetLastSystemError(); /* clang-format on */ this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); @@ -1093,7 +1096,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( // Forward the GHS variables to the inner project cache. for (std::string const& var : ghs_platform_vars) { if (cmValue val = this->Makefile->GetDefinition(var)) { - std::string flag = cmStrCat("-D", var, '=', '\'', *val, '\''); + std::string flag = cmStrCat("-D", var, "=\'", *val, '\''); arguments.CMakeFlags.emplace_back(std::move(flag)); cmakeVariables.emplace(var, *val); } @@ -1155,11 +1158,11 @@ cm::optional cmCoreTryCompile::TryCompileCode( } /* clang-format off */ err = cmStrCat( - "Cannot copy output executable\n", - " '", this->OutputFile, "'\n", - "to destination specified by COPY_FILE:\n", - " '", copyFile, "'\n", - "because:\n", + "Cannot copy output executable\n" + " '", this->OutputFile, "'\n" + "to destination specified by COPY_FILE:\n" + " '", copyFile, "'\n" + "because:\n" " ", err, "\n", this->FindErrorMessage); /* clang-format on */ -- cgit v0.12