summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoRcc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmQtAutoRcc.cxx')
-rw-r--r--Source/cmQtAutoRcc.cxx129
1 files changed, 45 insertions, 84 deletions
diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx
index 20885df..cc1a290 100644
--- a/Source/cmQtAutoRcc.cxx
+++ b/Source/cmQtAutoRcc.cxx
@@ -11,6 +11,7 @@
#include "cmFileLockResult.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
// -- Class methods
@@ -27,17 +28,15 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
};
auto InfoGetList =
[makefile](std::string const& key) -> std::vector<std::string> {
- std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
+ std::vector<std::string> list =
+ cmExpandedList(makefile->GetSafeDefinition(key));
return list;
};
auto InfoGetConfig = [makefile,
this](std::string const& key) -> std::string {
const char* valueConf = nullptr;
{
- std::string keyConf = key;
- keyConf += '_';
- keyConf += InfoConfig();
+ std::string keyConf = cmStrCat(key, '_', InfoConfig());
valueConf = makefile->GetDefinition(keyConf);
}
if (valueConf == nullptr) {
@@ -47,8 +46,7 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
};
auto InfoGetConfigList =
[&InfoGetConfig](std::string const& key) -> std::vector<std::string> {
- std::vector<std::string> list;
- cmSystemTools::ExpandListArgument(InfoGetConfig(key), list);
+ std::vector<std::string> list = cmExpandedList(InfoGetConfig(key));
return list;
};
auto LogInfoError = [this](std::string const& msg) -> bool {
@@ -81,9 +79,8 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
// - Rcc executable
RccExecutable_ = InfoGet("ARCC_RCC_EXECUTABLE");
if (!RccExecutableTime_.Load(RccExecutable_)) {
- std::string error = "The rcc executable ";
- error += Quoted(RccExecutable_);
- error += " does not exist.";
+ std::string error = cmStrCat("The rcc executable ", Quoted(RccExecutable_),
+ " does not exist.");
return LogInfoError(error);
}
RccListOptions_ = InfoGetList("ARCC_RCC_LIST_OPTIONS");
@@ -124,17 +121,12 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
// Init derived information
// ------------------------
- RccFilePublic_ = AutogenBuildDir_;
- RccFilePublic_ += '/';
- RccFilePublic_ += RccPathChecksum_;
- RccFilePublic_ += '/';
- RccFilePublic_ += RccFileName_;
+ RccFilePublic_ =
+ cmStrCat(AutogenBuildDir_, '/', RccPathChecksum_, '/', RccFileName_);
// Compute rcc output file name
if (IsMultiConfig()) {
- RccFileOutput_ = IncludeDir_;
- RccFileOutput_ += '/';
- RccFileOutput_ += MultiConfigOutput();
+ RccFileOutput_ = cmStrCat(IncludeDir_, '/', MultiConfigOutput());
} else {
RccFileOutput_ = RccFilePublic_;
}
@@ -178,10 +170,8 @@ bool cmQtAutoRcc::Process()
std::string cmQtAutoRcc::MultiConfigOutput() const
{
static std::string const suffix = "_CMAKE_";
- std::string res;
- res += RccPathChecksum_;
- res += '/';
- res += AppendFilenameSuffix(RccFileName_, suffix);
+ std::string res = cmStrCat(RccPathChecksum_, '/',
+ AppendFilenameSuffix(RccFileName_, suffix));
return res;
}
@@ -192,21 +182,10 @@ bool cmQtAutoRcc::SettingsFileRead()
cmCryptoHash crypt(cmCryptoHash::AlgoSHA256);
std::string const sep(" ~~~ ");
{
- std::string str;
- str += RccExecutable_;
- str += sep;
- str += cmJoin(RccListOptions_, ";");
- str += sep;
- str += QrcFile_;
- str += sep;
- str += RccPathChecksum_;
- str += sep;
- str += RccFileName_;
- str += sep;
- str += cmJoin(Options_, ";");
- str += sep;
- str += cmJoin(Inputs_, ";");
- str += sep;
+ std::string str =
+ cmStrCat(RccExecutable_, sep, cmJoin(RccListOptions_, ";"), sep,
+ QrcFile_, sep, RccPathChecksum_, sep, RccFileName_, sep,
+ cmJoin(Options_, ";"), sep, cmJoin(Inputs_, ";"), sep);
SettingsString_ = crypt.HashString(str);
}
}
@@ -272,9 +251,7 @@ bool cmQtAutoRcc::SettingsFileWrite()
Log().Info(GenT::RCC, "Writing settings file " + Quoted(SettingsFile_));
}
// Write settings file
- std::string content = "rcc:";
- content += SettingsString_;
- content += '\n';
+ std::string content = cmStrCat("rcc:", SettingsString_, '\n');
std::string error;
if (!FileWrite(SettingsFile_, content, &error)) {
Log().ErrorFile(GenT::RCC, SettingsFile_,
@@ -296,9 +273,8 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
// Test if the rcc input file exists
if (!QrcFileTime_.Load(QrcFile_)) {
std::string error;
- error = "The resources file ";
- error += Quoted(QrcFile_);
- error += " does not exist";
+ error =
+ cmStrCat("The resources file ", Quoted(QrcFile_), " does not exist");
Log().ErrorFile(GenT::RCC, QrcFile_, error);
return false;
}
@@ -306,10 +282,8 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
// Test if the rcc output file exists
if (!RccFileTime_.Load(RccFileOutput_)) {
if (Log().Verbose()) {
- Reason = "Generating ";
- Reason += Quoted(RccFileOutput_);
- Reason += ", because it doesn't exist, from ";
- Reason += Quoted(QrcFile_);
+ Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
+ ", because it doesn't exist, from ", Quoted(QrcFile_));
}
generate = true;
return true;
@@ -318,10 +292,9 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
// Test if the settings changed
if (SettingsChanged_) {
if (Log().Verbose()) {
- Reason = "Generating ";
- Reason += Quoted(RccFileOutput_);
- Reason += ", because the rcc settings changed, from ";
- Reason += Quoted(QrcFile_);
+ Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
+ ", because the rcc settings changed, from ",
+ Quoted(QrcFile_));
}
generate = true;
return true;
@@ -330,12 +303,9 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
// Test if the rcc output file is older than the .qrc file
if (RccFileTime_.Older(QrcFileTime_)) {
if (Log().Verbose()) {
- Reason = "Generating ";
- Reason += Quoted(RccFileOutput_);
- Reason += ", because it is older than ";
- Reason += Quoted(QrcFile_);
- Reason += ", from ";
- Reason += Quoted(QrcFile_);
+ Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
+ ", because it is older than ", Quoted(QrcFile_),
+ ", from ", Quoted(QrcFile_));
}
generate = true;
return true;
@@ -344,10 +314,9 @@ bool cmQtAutoRcc::TestQrcRccFiles(bool& generate)
// Test if the rcc output file is older than the rcc executable
if (RccFileTime_.Older(RccExecutableTime_)) {
if (Log().Verbose()) {
- Reason = "Generating ";
- Reason += Quoted(RccFileOutput_);
- Reason += ", because it is older than the rcc executable, from ";
- Reason += Quoted(QrcFile_);
+ Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
+ ", because it is older than the rcc executable, from ",
+ Quoted(QrcFile_));
}
generate = true;
return true;
@@ -374,21 +343,17 @@ bool cmQtAutoRcc::TestResources(bool& generate)
cmFileTime fileTime;
if (!fileTime.Load(resFile)) {
std::string error;
- error = "Could not find the resource file\n ";
- error += Quoted(resFile);
- error += '\n';
+ error = cmStrCat("Could not find the resource file\n ", Quoted(resFile),
+ '\n');
Log().ErrorFile(GenT::RCC, QrcFile_, error);
return false;
}
// Check if the resource file is newer than the rcc output file
if (RccFileTime_.Older(fileTime)) {
if (Log().Verbose()) {
- Reason = "Generating ";
- Reason += Quoted(RccFileOutput_);
- Reason += ", because it is older than ";
- Reason += Quoted(resFile);
- Reason += ", from ";
- Reason += Quoted(QrcFile_);
+ Reason = cmStrCat("Generating ", Quoted(RccFileOutput_),
+ ", because it is older than ", Quoted(resFile),
+ ", from ", Quoted(QrcFile_));
}
generate = true;
break;
@@ -402,10 +367,9 @@ bool cmQtAutoRcc::TestInfoFile()
// Test if the rcc output file is older than the info file
if (RccFileTime_.Older(InfoFileTime())) {
if (Log().Verbose()) {
- std::string reason = "Touching ";
- reason += Quoted(RccFileOutput_);
- reason += " because it is older than ";
- reason += Quoted(InfoFile());
+ std::string reason =
+ cmStrCat("Touching ", Quoted(RccFileOutput_),
+ " because it is older than ", Quoted(InfoFile()));
Log().Info(GenT::RCC, reason);
}
// Touch build file
@@ -456,10 +420,9 @@ bool cmQtAutoRcc::GenerateRcc()
if (!result || (retVal != 0)) {
// rcc process failed
{
- std::string err = "The rcc process failed to compile\n ";
- err += Quoted(QrcFile_);
- err += "\ninto\n ";
- err += Quoted(RccFileOutput_);
+ std::string err =
+ cmStrCat("The rcc process failed to compile\n ", Quoted(QrcFile_),
+ "\ninto\n ", Quoted(RccFileOutput_));
Log().ErrorCommand(GenT::RCC, err, cmd, rccStdOut + rccStdErr);
}
cmSystemTools::RemoveFile(RccFileOutput_);
@@ -481,12 +444,10 @@ bool cmQtAutoRcc::GenerateWrapper()
// Generate a wrapper source file on demand
if (IsMultiConfig()) {
// Wrapper file content
- std::string content;
- content += "// This is an autogenerated configuration wrapper file.\n";
- content += "// Changes will be overwritten.\n";
- content += "#include <";
- content += MultiConfigOutput();
- content += ">\n";
+ std::string content =
+ cmStrCat("// This is an autogenerated configuration wrapper file.\n",
+ "// Changes will be overwritten.\n", "#include <",
+ MultiConfigOutput(), ">\n");
// Compare with existing file content
bool fileDiffers = true;