summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudioVersionedGenerator.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-07-27 18:33:36 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-07-28 00:00:59 (GMT)
commit7137b1783549fb33fcc09eabdd0d77511d36c23b (patch)
tree2253f23d4869879ae5dbcee47c0ac8025b7a8aaa /Source/cmGlobalVisualStudioVersionedGenerator.cxx
parent2409f62d18b714f3342db99201eadc13420708da (diff)
downloadCMake-7137b1783549fb33fcc09eabdd0d77511d36c23b.zip
CMake-7137b1783549fb33fcc09eabdd0d77511d36c23b.tar.gz
CMake-7137b1783549fb33fcc09eabdd0d77511d36c23b.tar.bz2
cmStrCat: use in Windows-specific sources
Diffstat (limited to 'Source/cmGlobalVisualStudioVersionedGenerator.cxx')
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx134
1 files changed, 67 insertions, 67 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 44019f6..8b408a9 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -211,7 +211,7 @@ static const char* cmVS15GenName(const std::string& name, std::string& genName)
if (cmHasLiteralPrefix(p, " 2017")) {
p += 5;
}
- genName = std::string(vs15generatorName) + p;
+ genName = cmStrCat(vs15generatorName, p);
return p;
}
@@ -250,7 +250,7 @@ public:
cmDocumentationEntry GetDocumentation() const override
{
- return { std::string(vs15generatorName) + " [arch]",
+ return { cmStrCat(vs15generatorName, " [arch]"),
"Generates Visual Studio 2017 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\"." };
}
@@ -265,8 +265,8 @@ public:
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
{
std::vector<std::string> names;
- names.push_back(vs15generatorName + std::string(" ARM"));
- names.push_back(vs15generatorName + std::string(" Win64"));
+ names.push_back(cmStrCat(vs15generatorName, " ARM"));
+ names.push_back(cmStrCat(vs15generatorName, " Win64"));
return names;
}
@@ -306,7 +306,7 @@ static const char* cmVS16GenName(const std::string& name, std::string& genName)
if (cmHasLiteralPrefix(p, " 2019")) {
p += 5;
}
- genName = std::string(vs16generatorName) + p;
+ genName = cmStrCat(vs16generatorName, p);
return p;
}
@@ -320,7 +320,7 @@ static const char* cmVS17GenName(const std::string& name, std::string& genName)
if (cmHasLiteralPrefix(p, " 2022")) {
p += 5;
}
- genName = std::string(vs17generatorName) + p;
+ genName = cmStrCat(vs17generatorName, p);
return p;
}
@@ -526,18 +526,19 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
cmsys::RegularExpression versionRegex(
cmStrCat("^", majorStr, R"(\.[0-9]+\.[0-9]+\.[0-9]+$)"));
if (!versionRegex.find(this->GeneratorInstanceVersion)) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given instance specification\n"
- " " << i << "\n"
- "but the version field is not 4 integer components"
- " starting in " << majorStr << "."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given instance specification\n"
+ " ",
+ i,
+ "\n"
+ "but the version field is not 4 integer components"
+ " starting in ",
+ majorStr, "."));
return false;
}
}
@@ -566,14 +567,13 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
return false;
}
} else if (!this->vsSetupAPIHelper.GetVSInstanceInfo(vsInstance)) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "could not find any instance of Visual Studio.\n";
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "could not find any instance of Visual Studio.\n"));
return false;
}
@@ -619,47 +619,47 @@ bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance(
for (; fi != fields.end(); ++fi) {
std::string::size_type pos = fi->find('=');
if (pos == fi->npos) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given instance specification\n"
- " " << is << "\n"
- "that contains a field after the first ',' with no '='."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given instance specification\n"
+ " ",
+ is,
+ "\n"
+ "that contains a field after the first ',' with no '='."));
return false;
}
std::string const key = fi->substr(0, pos);
std::string const value = fi->substr(pos + 1);
if (!handled.insert(key).second) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given instance specification\n"
- " " << is << "\n"
- "that contains duplicate field key '" << key << "'."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given instance specification\n"
+ " ",
+ is,
+ "\n"
+ "that contains duplicate field key '",
+ key, "'."));
return false;
}
if (!this->ProcessGeneratorInstanceField(key, value)) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given instance specification\n"
- " " << is << "\n"
- "that contains invalid field '" << *fi << "'."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given instance specification\n"
+ " ",
+ is,
+ "\n"
+ "that contains invalid field '",
+ *fi, "'."));
return false;
}
}
@@ -956,8 +956,8 @@ bool cmGlobalVisualStudioVersionedGenerator::IsWin81SDKInstalled() const
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\"
"Windows Kits\\Installed Roots;KitsRoot81",
win81Root, cmSystemTools::KeyWOW64_32)) {
- return cmSystemTools::FileExists(win81Root + "/include/um/windows.h",
- true);
+ return cmSystemTools::FileExists(
+ cmStrCat(win81Root, "/include/um/windows.h"), true);
}
return false;
}
@@ -990,29 +990,29 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand()
if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS17) {
if (VSIsArm64Host()) {
if (VSHasDotNETFrameworkArm64()) {
- msbuild = vs + "/MSBuild/Current/Bin/arm64/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/arm64/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
}
if (VSIsWindows11OrGreater()) {
- msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/amd64/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
}
} else {
- msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/amd64/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
}
}
- msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
- msbuild = vs + "/MSBuild/15.0/Bin/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/15.0/Bin/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
@@ -1029,7 +1029,7 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindDevEnvCommand()
// Ask Visual Studio Installer tool.
std::string vs;
if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) {
- devenv = vs + "/Common7/IDE/devenv.com";
+ devenv = cmStrCat(vs, "/Common7/IDE/devenv.com");
if (cmSystemTools::FileExists(devenv)) {
return devenv;
}