mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-01-26 19:09:06 +00:00
Source: replace string addition to cmStrCat
This commit is contained in:
parent
32a68a0c40
commit
c42acbbecc
@ -388,12 +388,12 @@ int cmCPackFreeBSDGenerator::PackageFiles()
|
||||
// a file with the package name and version as specified in the
|
||||
// manifest, so we look those up (again). lastSlash is the slash
|
||||
// itself, we need that as path separator to the calculated package name.
|
||||
std::string actualPackage =
|
||||
((lastSlash != std::string::npos)
|
||||
? std::string(currentPackage, 0, lastSlash + 1)
|
||||
: std::string()) +
|
||||
var_lookup("CPACK_FREEBSD_PACKAGE_NAME") + '-' +
|
||||
var_lookup("CPACK_FREEBSD_PACKAGE_VERSION") + FreeBSDPackageSuffix_17;
|
||||
std::string actualPackage = cmStrCat(
|
||||
(lastSlash != std::string::npos)
|
||||
? cm::string_view(currentPackage).substr(0, lastSlash + 1)
|
||||
: ""_s,
|
||||
var_lookup("CPACK_FREEBSD_PACKAGE_NAME"), '-',
|
||||
var_lookup("CPACK_FREEBSD_PACKAGE_VERSION"), FreeBSDPackageSuffix_17);
|
||||
|
||||
this->packageFileNames.clear();
|
||||
this->packageFileNames.emplace_back(actualPackage);
|
||||
@ -442,7 +442,7 @@ int cmCPackFreeBSDGenerator::PackageFiles()
|
||||
std::string const packageSubDirectory =
|
||||
cmSystemTools::GetParentDirectory(sourceFile);
|
||||
std::string const targetFileName =
|
||||
packageSubDirectory + '/' + packageFileName;
|
||||
cmStrCat(packageSubDirectory, '/', packageFileName);
|
||||
if (cmSystemTools::RenameFile(sourceFile, targetFileName)) {
|
||||
this->packageFileNames.clear();
|
||||
this->packageFileNames.emplace_back(targetFileName);
|
||||
|
||||
@ -1610,12 +1610,12 @@ std::string cmCPackGenerator::GetSanitizedDirOrFileName(
|
||||
"[Ll][Pp][Tt][1-9]"
|
||||
")[.]?$");
|
||||
if (reserved_pattern.find(name)) {
|
||||
return "_" + name;
|
||||
return cmStrCat('_', std::move(name));
|
||||
}
|
||||
// Given name ends in a dot (on Windows)?
|
||||
// Then return it appended with an underscore.
|
||||
if (name.back() == '.') {
|
||||
return name + '_';
|
||||
return cmStrCat(std::move(name), '_');
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -889,7 +889,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
|
||||
{
|
||||
// Remove the old archive, if one exists
|
||||
std::string const& archiveFile =
|
||||
uploadDirectory + '/' + component->ArchiveFile;
|
||||
cmStrCat(uploadDirectory, '/', component->ArchiveFile);
|
||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||
"- Building downloaded component archive: " << archiveFile
|
||||
<< std::endl);
|
||||
|
||||
@ -773,7 +773,8 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
|
||||
}
|
||||
|
||||
// Remove the old archive, if one exists
|
||||
std::string archiveFile = uploadDirectory + '/' + component->ArchiveFile;
|
||||
std::string archiveFile =
|
||||
cmStrCat(uploadDirectory, '/', component->ArchiveFile);
|
||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||
"- Building downloaded component archive: " << archiveFile
|
||||
<< std::endl);
|
||||
|
||||
@ -514,11 +514,11 @@ void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml)
|
||||
char const* fname = launchDir.GetFile(i);
|
||||
if (this->IsLaunchedErrorFile(fname) && numErrorsAllowed) {
|
||||
numErrorsAllowed--;
|
||||
fragments.insert(this->CTestLaunchDir + '/' + fname);
|
||||
fragments.insert(cmStrCat(this->CTestLaunchDir, '/', fname));
|
||||
++this->TotalErrors;
|
||||
} else if (this->IsLaunchedWarningFile(fname) && numWarningsAllowed) {
|
||||
numWarningsAllowed--;
|
||||
fragments.insert(this->CTestLaunchDir + '/' + fname);
|
||||
fragments.insert(cmStrCat(this->CTestLaunchDir, '/', fname));
|
||||
++this->TotalWarnings;
|
||||
}
|
||||
}
|
||||
|
||||
@ -791,9 +791,9 @@ static std::string joinCommandLine(std::vector<std::string> const& args)
|
||||
|
||||
for (std::string const& s : args) {
|
||||
if (s.find(' ') == std::string::npos) {
|
||||
ret += s + ' ';
|
||||
ret = cmStrCat(std::move(ret), s, ' ');
|
||||
} else {
|
||||
ret += "\"" + s + "\" ";
|
||||
ret = cmStrCat(std::move(ret), '"', s, "\" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -216,10 +216,8 @@ bool ParseResult::MaybeReportError(cmMakefile& mf) const
|
||||
}
|
||||
std::string e;
|
||||
for (auto const& kel : this->KeywordErrors) {
|
||||
e = cmStrCat(e, "Error after keyword \"", kel.first, "\":\n");
|
||||
for (auto const& ke : kel.second) {
|
||||
e += ke;
|
||||
}
|
||||
e = cmStrCat(std::move(e), "Error after keyword \"", kel.first, "\":\n",
|
||||
cmJoin(kel.second, {}));
|
||||
}
|
||||
mf.IssueMessage(MessageType::FATAL_ERROR, e);
|
||||
return true;
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "cmStringAlgorithms.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <cstdlib>
|
||||
#endif
|
||||
@ -17,7 +19,6 @@
|
||||
#if defined(_WIN32)
|
||||
# include <cmext/string_view>
|
||||
|
||||
# include "cmStringAlgorithms.h"
|
||||
#endif
|
||||
|
||||
cmCMakePath& cmCMakePath::ReplaceWideExtension(cm::string_view extension)
|
||||
@ -33,7 +34,7 @@ cmCMakePath& cmCMakePath::ReplaceWideExtension(cm::string_view extension)
|
||||
if (extension[0] != '.') {
|
||||
file += '.';
|
||||
}
|
||||
file.append(std::string(extension));
|
||||
file = cmStrCat(std::move(file), extension);
|
||||
}
|
||||
this->Path.replace_filename(file);
|
||||
return *this;
|
||||
|
||||
@ -71,10 +71,9 @@ bool cmCacheManager::LoadCache(std::string const& path, bool internal,
|
||||
}
|
||||
while (realbuffer[0] == '/' && realbuffer[1] == '/') {
|
||||
if ((realbuffer[2] == '\\') && (realbuffer[3] == 'n')) {
|
||||
helpString += '\n';
|
||||
helpString += &realbuffer[4];
|
||||
helpString = cmStrCat(std::move(helpString), '\n', &realbuffer[4]);
|
||||
} else {
|
||||
helpString += &realbuffer[2];
|
||||
helpString = cmStrCat(std::move(helpString), &realbuffer[2]);
|
||||
}
|
||||
cmSystemTools::GetLineFromStream(fin, buffer);
|
||||
lineno++;
|
||||
@ -149,17 +148,17 @@ bool cmCacheManager::LoadCache(std::string const& path, bool internal,
|
||||
std::string currentcwd = path;
|
||||
std::string oldcwd = *oldDir;
|
||||
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
||||
currentcwd += "/CMakeCache.txt";
|
||||
oldcwd += "/CMakeCache.txt";
|
||||
currentcwd = cmStrCat(std::move(currentcwd), "/CMakeCache.txt");
|
||||
oldcwd = cmStrCat(std::move(oldcwd), "/CMakeCache.txt");
|
||||
if (!cmSystemTools::SameFile(oldcwd, currentcwd)) {
|
||||
cmValue dir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR");
|
||||
std::ostringstream message;
|
||||
message << "The current CMakeCache.txt directory " << currentcwd
|
||||
<< " is different than the directory " << (dir ? *dir : "")
|
||||
<< " where CMakeCache.txt was created. This may result "
|
||||
std::string message =
|
||||
cmStrCat("The current CMakeCache.txt directory ", currentcwd,
|
||||
" is different than the directory ", (dir ? *dir : ""),
|
||||
" where CMakeCache.txt was created. This may result "
|
||||
"in binaries being created in the wrong place. If you "
|
||||
"are not sure, reedit the CMakeCache.txt";
|
||||
cmSystemTools::Error(message.str());
|
||||
"are not sure, reedit the CMakeCache.txt");
|
||||
cmSystemTools::Error(message);
|
||||
}
|
||||
}
|
||||
this->CacheLoaded = true;
|
||||
@ -225,7 +224,8 @@ bool cmCacheManager::SaveCache(std::string const& path, cmMessenger* messenger)
|
||||
cmGeneratedFileStream fout(cacheFile);
|
||||
fout.SetCopyIfDifferent(true);
|
||||
if (!fout) {
|
||||
cmSystemTools::Error("Unable to open cache file for save. " + cacheFile);
|
||||
cmSystemTools::Error(
|
||||
cmStrCat("Unable to open cache file for save. ", std::move(cacheFile)));
|
||||
cmSystemTools::ReportLastSystemError("");
|
||||
return false;
|
||||
}
|
||||
@ -342,11 +342,12 @@ bool cmCacheManager::SaveCache(std::string const& path, cmMessenger* messenger)
|
||||
fout.Close();
|
||||
std::string checkCacheFile = cmStrCat(path, "/CMakeFiles");
|
||||
cmSystemTools::MakeDirectory(checkCacheFile);
|
||||
checkCacheFile += "/cmake.check_cache";
|
||||
checkCacheFile = cmStrCat(std::move(checkCacheFile), "/cmake.check_cache");
|
||||
cmsys::ofstream checkCache(checkCacheFile.c_str());
|
||||
if (!checkCache) {
|
||||
cmSystemTools::Error("Unable to open check cache file for write. " +
|
||||
checkCacheFile);
|
||||
cmSystemTools::Error(
|
||||
cmStrCat("Unable to open check cache file for write. ",
|
||||
std::move(checkCacheFile)));
|
||||
return false;
|
||||
}
|
||||
checkCache << "# This file is generated by cmake for dependency checking "
|
||||
|
||||
@ -393,9 +393,10 @@ std::string cmCommonTargetGenerator::GenerateCodeCheckRules(
|
||||
if (!compilerLauncher.empty()) {
|
||||
// In __run_co_compile case the launcher command is supplied
|
||||
// via --launcher=<maybe-list> and consumed
|
||||
code_check += " --launcher=";
|
||||
code_check += this->GeneratorTarget->GetLocalGenerator()->EscapeForShell(
|
||||
compilerLauncher);
|
||||
code_check =
|
||||
cmStrCat(std::move(code_check), " --launcher=",
|
||||
this->GeneratorTarget->GetLocalGenerator()->EscapeForShell(
|
||||
compilerLauncher));
|
||||
compilerLauncher.clear();
|
||||
}
|
||||
if (cmNonempty(iwyu)) {
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
file LICENSE.rst or https://cmake.org/licensing for details. */
|
||||
#include "cmCurl.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <cm/string_view>
|
||||
#include <cmext/string_view>
|
||||
|
||||
@ -28,9 +30,9 @@
|
||||
#define check_curl_result(result, errstr) \
|
||||
do { \
|
||||
if ((result) != CURLE_OK && (result) != CURLE_NOT_BUILT_IN) { \
|
||||
e += e.empty() ? "" : "\n"; \
|
||||
e += (errstr); \
|
||||
e += ::curl_easy_strerror(result); \
|
||||
bool isNeedNewline = !e.empty(); \
|
||||
e = cmStrCat(std::move(e), isNeedNewline ? "\n"_s : ""_s, (errstr), \
|
||||
::curl_easy_strerror(result)); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include "cmsys/FStream.hxx"
|
||||
|
||||
#include "cmDependsJavaLexer.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
int cmDependsJava_yyparse(yyscan_t yyscanner);
|
||||
@ -40,8 +41,7 @@ void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting(
|
||||
{
|
||||
std::string rname;
|
||||
if (prefix) {
|
||||
rname += prefix;
|
||||
rname += sep;
|
||||
rname = cmStrCat(std::move(rname), prefix, sep);
|
||||
}
|
||||
rname += this->Name;
|
||||
files->push_back(rname);
|
||||
@ -310,10 +310,10 @@ void cmDependsJavaParserHelper::UpdateCombine(char const* str1,
|
||||
char const* str2)
|
||||
{
|
||||
if (this->CurrentCombine.empty() && str1) {
|
||||
this->CurrentCombine = str1;
|
||||
// We can reuse allocated memory from `this->CurrentCombine`
|
||||
this->CurrentCombine = cmStrCat(std::move(this->CurrentCombine), str1);
|
||||
}
|
||||
this->CurrentCombine += ".";
|
||||
this->CurrentCombine += str2;
|
||||
this->CurrentCombine = cmStrCat(std::move(this->CurrentCombine), '.', str2);
|
||||
}
|
||||
|
||||
int cmDependsJavaParserHelper::ParseFile(char const* file)
|
||||
@ -329,7 +329,7 @@ int cmDependsJavaParserHelper::ParseFile(char const* file)
|
||||
std::string fullfile;
|
||||
std::string line;
|
||||
while (cmSystemTools::GetLineFromStream(ifs, line)) {
|
||||
fullfile += line + "\n";
|
||||
fullfile = cmStrCat(std::move(fullfile), line, '\n');
|
||||
}
|
||||
return this->ParseString(fullfile.c_str(), 0);
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ bool cmDocumentation::PrintFiles(std::ostream& os, std::string const& pattern)
|
||||
std::vector<std::string> files;
|
||||
this->GlobHelp(files, pattern);
|
||||
std::sort(files.begin(), files.end());
|
||||
cmRST r(os, cmSystemTools::GetCMakeRoot() + "/Help");
|
||||
cmRST r(os, cmStrCat(cmSystemTools::GetCMakeRoot(), "/Help"));
|
||||
for (std::string const& f : files) {
|
||||
found = r.ProcessFile(f) || found;
|
||||
}
|
||||
|
||||
@ -68,9 +68,9 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
|
||||
|
||||
if (gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
|
||||
gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
|
||||
sharedLibs += " " + lib;
|
||||
sharedLibs = cmStrCat(std::move(sharedLibs), ' ', lib);
|
||||
} else {
|
||||
staticLibs += " " + lib;
|
||||
staticLibs = cmStrCat(std::move(staticLibs), ' ', lib);
|
||||
}
|
||||
} else {
|
||||
bool relpath = false;
|
||||
@ -82,10 +82,10 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
|
||||
// if it is full or a link library then use string directly
|
||||
if (cmSystemTools::FileIsFullPath(lib) ||
|
||||
cmHasLiteralPrefix(lib, "-l") || relpath) {
|
||||
ldlibs += " " + lib;
|
||||
ldlibs = cmStrCat(std::move(ldlibs), ' ', lib);
|
||||
// if it is not a path and does not have a -l then add -l
|
||||
} else if (!lib.empty()) {
|
||||
ldlibs += " -l" + lib;
|
||||
ldlibs = cmStrCat(std::move(ldlibs), " -l", lib);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -738,7 +738,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
|
||||
// - only if not named the same as an output directory
|
||||
if (!cmSystemTools::FileIsDirectory(
|
||||
cmStrCat(this->HomeOutputDirectory, '/', p))) {
|
||||
excludeFromOut += p + "/|";
|
||||
excludeFromOut = cmStrCat(std::move(excludeFromOut), p, "/|");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -328,7 +328,7 @@ std::string cmExtraKateGenerator::GenerateProjectName(
|
||||
std::string const& name, std::string const& type,
|
||||
std::string const& path) const
|
||||
{
|
||||
return name + (type.empty() ? "" : "-") + type + '@' + path;
|
||||
return cmStrCat(name, (type.empty() ? "" : "-"), type, '@', path);
|
||||
}
|
||||
|
||||
std::string cmExtraKateGenerator::GetPathBasename(
|
||||
|
||||
@ -318,14 +318,12 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
|
||||
std::string generator = this->GlobalGenerator->GetName();
|
||||
if (generator == "NMake Makefiles") {
|
||||
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
||||
command += R"(, "/NOLOGO", "/f", ")";
|
||||
command += makefileName + "\"";
|
||||
command += ", \"" + target + "\"";
|
||||
command = cmStrCat(std::move(command), R"(, "/NOLOGO", "/f", ")",
|
||||
std::move(makefileName), "\", \"", target, '"');
|
||||
} else if (generator == "Ninja") {
|
||||
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
||||
command += R"(, "-f", ")";
|
||||
command += makefileName + "\"";
|
||||
command += ", \"" + target + "\"";
|
||||
command = cmStrCat(std::move(command), R"(, "-f", ")",
|
||||
std::move(makefileName), "\", \"", target, '"');
|
||||
} else {
|
||||
std::string makefileName;
|
||||
if (generator == "MinGW Makefiles") {
|
||||
@ -335,9 +333,8 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
|
||||
} else {
|
||||
makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
||||
}
|
||||
command += R"(, "-f", ")";
|
||||
command += makefileName + "\"";
|
||||
command += ", \"" + target + "\"";
|
||||
command = cmStrCat(std::move(command), R"(, "-f", ")",
|
||||
std::move(makefileName), "\", \"", target, '"');
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
@ -339,9 +339,9 @@ void cmFastbuildTargetGenerator::AddOutput(cmCustomCommandGenerator const& ccg,
|
||||
void cmFastbuildTargetGenerator::AddExecArguments(
|
||||
FastbuildExecNode& exec, std::string const& scriptFilename) const
|
||||
{
|
||||
exec.ExecArguments = FASTBUILD_SCRIPT_FILE_ARG;
|
||||
exec.ExecArguments +=
|
||||
cmGlobalFastbuildGenerator::QuoteIfHasSpaces(scriptFilename);
|
||||
exec.ExecArguments =
|
||||
cmStrCat(FASTBUILD_SCRIPT_FILE_ARG,
|
||||
cmGlobalFastbuildGenerator::QuoteIfHasSpaces(scriptFilename));
|
||||
|
||||
exec.ScriptFile = scriptFilename;
|
||||
exec.ExecExecutable =
|
||||
@ -510,18 +510,16 @@ FastbuildExecNode cmFastbuildTargetGenerator::GetDepsCheckExec(
|
||||
exec.ExecUseStdOutAsOutput = true;
|
||||
exec.ExecOutput = depender.ExecOutput + ".deps-checker";
|
||||
exec.ExecExecutable = cmSystemTools::GetCMakeCommand();
|
||||
exec.ExecArguments += "-E cmake_fastbuild_check_depends ";
|
||||
exec.ExecArguments += depender.ExecOutput + ' ';
|
||||
char const* sep = "";
|
||||
exec.ExecArguments =
|
||||
cmStrCat(std::move(exec.ExecArguments),
|
||||
"-E cmake_fastbuild_check_depends ", depender.ExecOutput);
|
||||
for (auto const& dep : depender.OutputsAlias.PreBuildDependencies) {
|
||||
exec.ExecArguments += sep;
|
||||
exec.ExecArguments += dep.Name;
|
||||
sep = " ";
|
||||
exec.ExecArguments =
|
||||
cmStrCat(std::move(exec.ExecArguments), ' ', dep.Name);
|
||||
}
|
||||
for (auto const& dep : depender.ByproductsAlias.PreBuildDependencies) {
|
||||
exec.ExecArguments += sep;
|
||||
exec.ExecArguments += dep.Name;
|
||||
sep = " ";
|
||||
exec.ExecArguments =
|
||||
cmStrCat(std::move(exec.ExecArguments), ' ', dep.Name);
|
||||
}
|
||||
return exec;
|
||||
}
|
||||
|
||||
@ -2060,9 +2060,9 @@ Json::Value Target::DumpArtifacts()
|
||||
this->GT->GetOutputInfo(this->Config);
|
||||
if (output && !output->PdbDir.empty()) {
|
||||
Json::Value artifact = Json::objectValue;
|
||||
artifact["path"] = RelativeIfUnder(this->TopBuild,
|
||||
output->PdbDir + '/' +
|
||||
this->GT->GetPDBName(this->Config));
|
||||
artifact["path"] = RelativeIfUnder(
|
||||
this->TopBuild,
|
||||
cmStrCat(output->PdbDir, '/', this->GT->GetPDBName(this->Config)));
|
||||
artifacts.append(std::move(artifact)); // NOLINT(*)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1607,9 +1607,10 @@ bool HandleRemoveImpl(std::vector<std::string> const& args, bool recurse,
|
||||
{
|
||||
std::string fileName = arg;
|
||||
if (fileName.empty()) {
|
||||
std::string const r = recurse ? "REMOVE_RECURSE" : "REMOVE";
|
||||
std::string r = recurse ? "REMOVE_RECURSE" : "REMOVE";
|
||||
status.GetMakefile().IssueMessage(
|
||||
MessageType::AUTHOR_WARNING, "Ignoring empty file name in " + r + ".");
|
||||
MessageType::AUTHOR_WARNING,
|
||||
cmStrCat("Ignoring empty file name in ", std::move(r), '.'));
|
||||
continue;
|
||||
}
|
||||
if (!cmsys::SystemTools::FileIsFullPath(fileName)) {
|
||||
@ -2195,8 +2196,9 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
|
||||
}
|
||||
|
||||
for (auto const& range : curl_ranges) {
|
||||
std::string curl_range = range.first + '-' +
|
||||
(range.second.has_value() ? range.second.value() : "");
|
||||
std::string curl_range =
|
||||
cmStrCat(range.first, '-',
|
||||
(range.second.has_value() ? range.second.value() : ""));
|
||||
res = ::curl_easy_setopt(curl, CURLOPT_RANGE, curl_range.c_str());
|
||||
check_curl_result(res, "DOWNLOAD cannot set range: ");
|
||||
}
|
||||
@ -3203,7 +3205,8 @@ bool HandleCreateLinkCommand(std::vector<std::string> const& args,
|
||||
parser.Parse(cmMakeRange(args).advance(3), &unconsumedArgs);
|
||||
|
||||
if (!unconsumedArgs.empty()) {
|
||||
status.SetError("unknown argument: \"" + unconsumedArgs.front() + '\"');
|
||||
status.SetError(cmStrCat("unknown argument: \"",
|
||||
std::move(unconsumedArgs.front()), '\"'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -322,7 +322,7 @@ std::string cmGeneratorTarget::GetOutputName(
|
||||
std::string configUpper = cmSystemTools::UpperCase(config);
|
||||
if (!type.empty() && !configUpper.empty()) {
|
||||
// <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
|
||||
props.push_back(type + "_OUTPUT_NAME_" + configUpper);
|
||||
props.push_back(cmStrCat(type, "_OUTPUT_NAME_", configUpper));
|
||||
}
|
||||
if (!type.empty()) {
|
||||
// <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
|
||||
@ -357,7 +357,8 @@ std::string cmGeneratorTarget::GetOutputName(
|
||||
// from the above block.
|
||||
this->LocalGenerator->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
"Target '" + this->GetName() + "' OUTPUT_NAME depends on itself.",
|
||||
cmStrCat("Target '", this->GetName(),
|
||||
"' OUTPUT_NAME depends on itself."),
|
||||
this->GetBacktrace());
|
||||
}
|
||||
return i->second;
|
||||
@ -806,7 +807,8 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
|
||||
cmPolicies::PolicyStatus cmp0069 = this->GetPolicyStatusCMP0069();
|
||||
|
||||
if (cmp0069 == cmPolicies::OLD || cmp0069 == cmPolicies::WARN) {
|
||||
if (this->Makefile->IsOn("_CMAKE_" + lang + "_IPO_LEGACY_BEHAVIOR")) {
|
||||
if (this->Makefile->IsOn(
|
||||
cmStrCat("_CMAKE_", lang, "_IPO_LEGACY_BEHAVIOR"))) {
|
||||
return true;
|
||||
}
|
||||
if (this->PolicyReportedCMP0069) {
|
||||
@ -2683,32 +2685,33 @@ void cmGeneratorTarget::AddCUDAArchitectureFlagsImpl(cmBuildStep compileOrLink,
|
||||
}
|
||||
|
||||
for (CudaArchitecture& architecture : architectures) {
|
||||
flags +=
|
||||
" \"--generate-code=arch=compute_" + architecture.name + ",code=[";
|
||||
flags = cmStrCat(std::move(flags), " \"--generate-code=arch=compute_",
|
||||
architecture.name, ",code=[");
|
||||
|
||||
if (architecture.virtual_) {
|
||||
flags += "compute_" + architecture.name;
|
||||
flags = cmStrCat(std::move(flags), "compute_", architecture.name);
|
||||
|
||||
if (ipoEnabled || architecture.real) {
|
||||
flags += ",";
|
||||
flags += ',';
|
||||
}
|
||||
}
|
||||
|
||||
if (ipoEnabled) {
|
||||
if (compileOrLink == cmBuildStep::Compile) {
|
||||
flags += "lto_" + architecture.name;
|
||||
flags = cmStrCat(std::move(flags), "lto_", architecture.name);
|
||||
} else if (compileOrLink == cmBuildStep::Link) {
|
||||
flags += "sm_" + architecture.name;
|
||||
flags = cmStrCat(std::move(flags), "sm_", architecture.name);
|
||||
}
|
||||
} else if (architecture.real) {
|
||||
flags += "sm_" + architecture.name;
|
||||
flags = cmStrCat(std::move(flags), "sm_", architecture.name);
|
||||
}
|
||||
|
||||
flags += "]\"";
|
||||
}
|
||||
} else if (compiler == "Clang" && compileOrLink == cmBuildStep::Compile) {
|
||||
for (CudaArchitecture& architecture : architectures) {
|
||||
flags += " --cuda-gpu-arch=sm_" + architecture.name;
|
||||
flags =
|
||||
cmStrCat(std::move(flags), " --cuda-gpu-arch=sm_", architecture.name);
|
||||
|
||||
if (!architecture.real) {
|
||||
this->Makefile->IssueMessage(
|
||||
@ -2717,7 +2720,8 @@ void cmGeneratorTarget::AddCUDAArchitectureFlagsImpl(cmBuildStep compileOrLink,
|
||||
}
|
||||
|
||||
if (!architecture.virtual_) {
|
||||
flags += " --no-cuda-include-ptx=sm_" + architecture.name;
|
||||
flags = cmStrCat(std::move(flags), " --no-cuda-include-ptx=sm_",
|
||||
architecture.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2750,9 +2754,10 @@ void cmGeneratorTarget::AddHIPArchitectureFlags(cmBuildStep compileOrLink,
|
||||
std::string arch = this->GetSafeProperty("HIP_ARCHITECTURES");
|
||||
|
||||
if (arch.empty()) {
|
||||
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
|
||||
"HIP_ARCHITECTURES is empty for target \"" +
|
||||
this->GetName() + "\".");
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("HIP_ARCHITECTURES is empty for target \"", this->GetName(),
|
||||
"\"."));
|
||||
}
|
||||
|
||||
// If HIP_ARCHITECTURES is false we don't add any architectures.
|
||||
@ -2816,29 +2821,29 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
|
||||
{
|
||||
switch (this->GetType()) {
|
||||
case cmStateEnums::STATIC_LIBRARY: {
|
||||
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
|
||||
std::string var = cmStrCat("CMAKE_", lang, "_CREATE_STATIC_LIBRARY");
|
||||
return this->GetFeatureSpecificLinkRuleVariable(var, lang, config);
|
||||
}
|
||||
case cmStateEnums::SHARED_LIBRARY:
|
||||
if (this->IsArchivedAIXSharedLibrary()) {
|
||||
return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY_ARCHIVE";
|
||||
return cmStrCat("CMAKE_", lang, "_CREATE_SHARED_LIBRARY_ARCHIVE");
|
||||
}
|
||||
return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY";
|
||||
return cmStrCat("CMAKE_", lang, "_CREATE_SHARED_LIBRARY");
|
||||
case cmStateEnums::MODULE_LIBRARY:
|
||||
return "CMAKE_" + lang + "_CREATE_SHARED_MODULE";
|
||||
return cmStrCat("CMAKE_", lang, "_CREATE_SHARED_MODULE");
|
||||
case cmStateEnums::EXECUTABLE:
|
||||
if (this->IsExecutableWithExports()) {
|
||||
std::string linkExeWithExports =
|
||||
"CMAKE_" + lang + "_LINK_EXECUTABLE_WITH_EXPORTS";
|
||||
cmStrCat("CMAKE_", lang, "_LINK_EXECUTABLE_WITH_EXPORTS");
|
||||
if (this->Makefile->IsDefinitionSet(linkExeWithExports)) {
|
||||
return linkExeWithExports;
|
||||
}
|
||||
}
|
||||
return "CMAKE_" + lang + "_LINK_EXECUTABLE";
|
||||
return cmStrCat("CMAKE_", lang, "_LINK_EXECUTABLE");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -3276,9 +3281,9 @@ std::string cmGeneratorTarget::GetPchCreateCompileOptions(
|
||||
if (GlobalGenerator->IsFastbuild()) {
|
||||
// Account for potential spaces in a shell-friendly way.
|
||||
cmSystemTools::ReplaceString(createOptionList, "<PCH_HEADER>",
|
||||
'"' + pchHeader + '"');
|
||||
cmStrCat('"', pchHeader, '"'));
|
||||
cmSystemTools::ReplaceString(createOptionList, "<PCH_FILE>",
|
||||
'"' + pchFile + '"');
|
||||
cmStrCat('"', pchFile, '"'));
|
||||
} else {
|
||||
cmSystemTools::ReplaceString(createOptionList, "<PCH_HEADER>",
|
||||
pchHeader);
|
||||
@ -3320,9 +3325,9 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
|
||||
if (GlobalGenerator->IsFastbuild()) {
|
||||
// Account for potential spaces in a shell-friendly way.
|
||||
cmSystemTools::ReplaceString(useOptionList, "<PCH_HEADER>",
|
||||
'"' + pchHeader + '"');
|
||||
cmStrCat('"', pchHeader, '"'));
|
||||
cmSystemTools::ReplaceString(useOptionList, "<PCH_FILE>",
|
||||
'"' + pchFile + '"');
|
||||
cmStrCat('"', pchFile, '"'));
|
||||
} else {
|
||||
cmSystemTools::ReplaceString(useOptionList, "<PCH_HEADER>", pchHeader);
|
||||
cmSystemTools::ReplaceString(useOptionList, "<PCH_FILE>", pchFile);
|
||||
@ -4021,7 +4026,7 @@ std::string cmGeneratorTarget::GetPDBOutputName(
|
||||
// from the above block.
|
||||
this->LocalGenerator->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
"Target '" + this->GetName() + "' PDB_NAME depends on itself.",
|
||||
cmStrCat("Target '", this->GetName(), "' PDB_NAME depends on itself."),
|
||||
this->GetBacktrace());
|
||||
}
|
||||
return i->second;
|
||||
@ -4541,7 +4546,8 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
|
||||
// from the above block.
|
||||
this->LocalGenerator->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
"Target '" + this->GetName() + "' OUTPUT_DIRECTORY depends on itself.",
|
||||
cmStrCat("Target '", this->GetName(),
|
||||
"' OUTPUT_DIRECTORY depends on itself."),
|
||||
this->GetBacktrace());
|
||||
return nullptr;
|
||||
}
|
||||
@ -6347,7 +6353,8 @@ std::string cmGeneratorTarget::GetSwiftModuleFileName() const
|
||||
if (this->GetPolicyStatusCMP0195() == cmPolicies::NEW) {
|
||||
if (cmValue moduleTriple =
|
||||
this->Makefile->GetDefinition("CMAKE_Swift_MODULE_TRIPLE")) {
|
||||
moduleFilename += "/" + *moduleTriple + ".swiftmodule";
|
||||
moduleFilename = cmStrCat(std::move(moduleFilename), '/', *moduleTriple,
|
||||
".swiftmodule");
|
||||
}
|
||||
}
|
||||
return moduleFilename;
|
||||
@ -6383,8 +6390,8 @@ std::string cmGeneratorTarget::GetSwiftModuleDirectory(
|
||||
std::string cmGeneratorTarget::GetSwiftModulePath(
|
||||
std::string const& config) const
|
||||
{
|
||||
return this->GetSwiftModuleDirectory(config) + "/" +
|
||||
this->GetSwiftModuleFileName();
|
||||
return cmStrCat(this->GetSwiftModuleDirectory(config), '/',
|
||||
this->GetSwiftModuleFileName());
|
||||
}
|
||||
|
||||
std::string cmGeneratorTarget::GetPropertyOrDefault(
|
||||
|
||||
@ -679,8 +679,9 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
|
||||
if (propInitialized) {
|
||||
std::pair<bool, PropertyType> consistent =
|
||||
consistentProperty(propContent, ifacePropContent, t);
|
||||
report += reportEntry;
|
||||
report += compatibilityAgree(t, propContent != consistent.second);
|
||||
report =
|
||||
cmStrCat(std::move(report), reportEntry,
|
||||
compatibilityAgree(t, propContent != consistent.second));
|
||||
if (!consistent.first) {
|
||||
std::ostringstream e;
|
||||
e << "The INTERFACE_" << p << " property of \""
|
||||
@ -692,7 +693,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
|
||||
propContent = consistent.second;
|
||||
continue;
|
||||
}
|
||||
report += reportEntry + "(Interface set)\n";
|
||||
report = cmStrCat(std::move(report), reportEntry, "(Interface set)\n");
|
||||
propContent = ifacePropContent;
|
||||
propInitialized = true;
|
||||
} else {
|
||||
|
||||
@ -65,7 +65,7 @@ bool cmGeneratorTarget::MaybeHaveInterfaceProperty(std::string const& prop,
|
||||
cm::GenEx::Evaluation* eval,
|
||||
UseTo usage) const
|
||||
{
|
||||
std::string const key = prop + '@' + eval->Context.Config;
|
||||
std::string const key = cmStrCat(prop, '@', eval->Context.Config);
|
||||
auto i = this->MaybeInterfacePropertyExists.find(key);
|
||||
if (i == this->MaybeInterfacePropertyExists.end()) {
|
||||
// Insert an entry now in case there is a cycle.
|
||||
|
||||
@ -658,8 +658,9 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
||||
} else {
|
||||
std::vector<cmSourceFile const*> customCommands;
|
||||
if (this->ComputeCustomCommandOrder(customCommands)) {
|
||||
std::string message = "The custom commands for target [" +
|
||||
this->GeneratorTarget->GetName() + "] had a cycle.\n";
|
||||
std::string message =
|
||||
cmStrCat("The custom commands for target [",
|
||||
this->GeneratorTarget->GetName(), "] had a cycle.\n");
|
||||
cmSystemTools::Error(message);
|
||||
} else {
|
||||
/* Custom targets do not have a dependency on SOURCES files.
|
||||
|
||||
@ -699,7 +699,7 @@ std::string cmGlobalFastbuildGenerator::Quote(std::string const& str,
|
||||
std::string cmGlobalFastbuildGenerator::QuoteIfHasSpaces(std::string str)
|
||||
{
|
||||
if (str.find(' ') != std::string::npos) {
|
||||
return '"' + str + '"';
|
||||
return cmStrCat('"', str, '"');
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@ -976,7 +976,7 @@ void cmGlobalFastbuildGenerator::AddCompiler(std::string const& language,
|
||||
}
|
||||
|
||||
// Calculate the root location of the compiler
|
||||
std::string const variableString = "CMAKE_" + language + "_COMPILER";
|
||||
std::string const variableString = cmStrCat("CMAKE_", language, "_COMPILER");
|
||||
std::string const compilerLocation = mf->GetSafeDefinition(variableString);
|
||||
if (compilerLocation.empty()) {
|
||||
return;
|
||||
@ -992,15 +992,15 @@ void cmGlobalFastbuildGenerator::AddCompiler(std::string const& language,
|
||||
compilerDef.Name = FASTBUILD_COMPILER_PREFIX + language;
|
||||
compilerDef.Executable = compilerLocation;
|
||||
compilerDef.CmakeCompilerID =
|
||||
mf->GetSafeDefinition("CMAKE_" + language + "_COMPILER_ID");
|
||||
mf->GetSafeDefinition(cmStrCat("CMAKE_", language, "_COMPILER_ID"));
|
||||
if (compilerDef.CmakeCompilerID == "Clang" &&
|
||||
mf->GetSafeDefinition("CMAKE_" + language +
|
||||
"_COMPILER_FRONTEND_VARIANT") == "MSVC") {
|
||||
mf->GetSafeDefinition(cmStrCat(
|
||||
"CMAKE_", language, "_COMPILER_FRONTEND_VARIANT")) == "MSVC") {
|
||||
compilerDef.CmakeCompilerID = "Clang-cl";
|
||||
}
|
||||
|
||||
compilerDef.CmakeCompilerVersion =
|
||||
mf->GetSafeDefinition("CMAKE_" + language + "_COMPILER_VERSION");
|
||||
mf->GetSafeDefinition(cmStrCat("CMAKE_", language, "_COMPILER_VERSION"));
|
||||
compilerDef.Language = language;
|
||||
|
||||
cmExpandList(mf->GetSafeDefinition(FASTBUILD_COMPILER_EXTRA_FILES),
|
||||
@ -1052,10 +1052,11 @@ void cmGlobalFastbuildGenerator::AddCompiler(std::string const& language,
|
||||
compilerDef.ExtraFiles.push_back("$Root$/vcruntime140.dll");
|
||||
compilerDef.ExtraFiles.push_back(
|
||||
"$Root$/vcruntime140_1.dll"); // Required as of 16.5.1 (14.25.28610)
|
||||
compilerDef.ExtraFiles.push_back("$Root$/" + i18nNum + "/clui.dll");
|
||||
compilerDef.ExtraFiles.push_back(
|
||||
"$Root$/" + i18nNum + "/mspft140ui.dll"); // Localized messages for
|
||||
// static analysis
|
||||
cmStrCat("$Root$/", i18nNum, "/clui.dll"));
|
||||
compilerDef.ExtraFiles.push_back(cmStrCat(
|
||||
"$Root$/", i18nNum, "/mspft140ui.dll")); // Localized messages for
|
||||
// static analysis
|
||||
}
|
||||
// Visual Studio 15 (19.10 to 19.19)
|
||||
else if (cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL,
|
||||
|
||||
@ -246,5 +246,5 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
|
||||
|
||||
std::string cmInstallExportGenerator::GetDestinationFile() const
|
||||
{
|
||||
return this->Destination + '/' + this->FileName;
|
||||
return cmStrCat(this->Destination, '/', this->FileName);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user