summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerators.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-08-31 20:26:47 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-09-07 15:53:19 (GMT)
commitf23a24c2878ffc0b6f769d5a61509b254d082c03 (patch)
tree2a32a37d144efd9ef976685201b88e1b8e83a5aa /Source/cmQtAutoGenerators.cxx
parent37ef18a468149ba579b96a763ea3042a360652d7 (diff)
downloadCMake-f23a24c2878ffc0b6f769d5a61509b254d082c03.zip
CMake-f23a24c2878ffc0b6f769d5a61509b254d082c03.tar.gz
CMake-f23a24c2878ffc0b6f769d5a61509b254d082c03.tar.bz2
Autogen: Use list of lists functions for UIC options
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r--Source/cmQtAutoGenerators.cxx68
1 files changed, 24 insertions, 44 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 8dc6420..71e51bd 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -200,26 +200,6 @@ static bool ListContains(const std::vector<std::string>& list,
return (std::find(list.begin(), list.end(), entry) != list.end());
}
-static std::string JoinOptionsList(const std::vector<std::string>& opts)
-{
- return cmOutputConverter::EscapeForCMake(cmJoin(opts, ";"));
-}
-
-static std::string JoinOptionsMap(
- const std::map<std::string, std::string>& opts)
-{
- std::string result;
- for (const auto& item : opts) {
- if (!result.empty()) {
- result += cmQtAutoGen::listSep;
- }
- result += item.first;
- result += "===";
- result += item.second;
- }
- return result;
-}
-
// -- Class methods
cmQtAutoGenerators::cmQtAutoGenerators()
@@ -433,18 +413,17 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
InfoGetConfig(makefile, "AM_UIC_TARGET_OPTIONS", config,
this->UicTargetOptions);
{
- std::vector<std::string> uicFilesVec;
- std::vector<std::string> uicOptionsVec;
- InfoGet(makefile, "AM_UIC_OPTIONS_FILES", uicFilesVec);
- InfoGet(makefile, "AM_UIC_OPTIONS_OPTIONS", uicOptionsVec);
+ auto uicFiles = InfoGetList(makefile, "AM_UIC_OPTIONS_FILES");
+ auto uicOptions = InfoGetLists(makefile, "AM_UIC_OPTIONS_OPTIONS");
// Compare list sizes
- if (uicFilesVec.size() == uicOptionsVec.size()) {
- for (std::vector<std::string>::iterator
- fileIt = uicFilesVec.begin(),
- optionIt = uicOptionsVec.begin();
- fileIt != uicFilesVec.end(); ++fileIt, ++optionIt) {
- cmSystemTools::ReplaceString(*optionIt, cmQtAutoGen::listSep, ";");
- this->UicOptions[*fileIt] = *optionIt;
+ if (uicFiles.size() == uicOptions.size()) {
+ auto fitEnd = uicFiles.cend();
+ auto fit = uicFiles.begin();
+ auto oit = uicOptions.begin();
+ while (fit != fitEnd) {
+ this->UicOptions[*fit] = std::move(*oit);
+ ++fit;
+ ++oit;
}
} else {
this->LogError(
@@ -519,15 +498,15 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile)
std::string str;
str += this->MocExecutable;
str += sep;
- str += JoinOptionsList(this->MocDefinitions);
+ str += cmJoin(this->MocDefinitions, ";");
str += sep;
- str += JoinOptionsList(this->MocIncludePaths);
+ str += cmJoin(this->MocIncludePaths, ";");
str += sep;
- str += JoinOptionsList(this->MocOptions);
+ str += cmJoin(this->MocOptions, ";");
str += sep;
str += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE";
str += sep;
- str += JoinOptionsList(this->MocPredefsCmd);
+ str += cmJoin(this->MocPredefsCmd, ";");
str += sep;
this->SettingsStringMoc = crypt.HashString(str);
}
@@ -535,9 +514,13 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile)
std::string str;
str += this->UicExecutable;
str += sep;
- str += JoinOptionsList(this->UicTargetOptions);
- str += sep;
- str += JoinOptionsMap(this->UicOptions);
+ str += cmJoin(this->UicTargetOptions, ";");
+ for (const auto& item : this->UicOptions) {
+ str += sep;
+ str += item.first;
+ str += sep;
+ str += cmJoin(item.second, ";");
+ }
str += sep;
this->SettingsStringUic = crypt.HashString(str);
}
@@ -550,7 +533,7 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile)
str += sep;
str += rccJob.RccFile;
str += sep;
- str += JoinOptionsList(rccJob.Options);
+ str += cmJoin(rccJob.Options, ";");
}
str += sep;
this->SettingsStringRcc = crypt.HashString(str);
@@ -1566,12 +1549,9 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
cmd.push_back(this->UicExecutable);
{
std::vector<std::string> allOpts = this->UicTargetOptions;
- std::map<std::string, std::string>::const_iterator optionIt =
- this->UicOptions.find(uiInputFile);
+ auto optionIt = this->UicOptions.find(uiInputFile);
if (optionIt != this->UicOptions.end()) {
- std::vector<std::string> fileOpts;
- cmSystemTools::ExpandListArgument(optionIt->second, fileOpts);
- cmQtAutoGen::UicMergeOptions(allOpts, fileOpts,
+ cmQtAutoGen::UicMergeOptions(allOpts, optionIt->second,
(this->QtMajorVersion == "5"));
}
cmd.insert(cmd.end(), allOpts.begin(), allOpts.end());