Autogen: Embrace qrc file lists in braces in AutogenInfo.cmake

This allows empty .qrc files in any list position.
This commit is contained in:
Sebastian Holtermann 2017-03-02 12:32:47 +01:00
parent 0d9a5baa0e
commit a28ae16e3c
3 changed files with 31 additions and 26 deletions

View File

@ -152,7 +152,7 @@ static bool RccListInputsQt5(const std::string& rccCommand,
// - Class definitions
const char* cmQtAutoGeneratorCommon::listSep = "@list_sep@";
const char* cmQtAutoGeneratorCommon::listSep = "@LSEP@";
bool cmQtAutoGeneratorCommon::RccListInputs(const std::string& qtMajorVersion,
const std::string& rccCommand,

View File

@ -489,16 +489,17 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target,
_rcc_files.push_back(absFile);
// qrc file entries
{
std::string entriesList;
std::string entriesList = "{";
if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
std::vector<std::string> files;
if (cmQtAutoGeneratorCommon::RccListInputs(
qtMajorVersion, rccCommand, absFile, files)) {
entriesList = cmJoin(files, cmQtAutoGeneratorCommon::listSep);
entriesList += cmJoin(files, cmQtAutoGeneratorCommon::listSep);
} else {
return;
}
}
entriesList += "}";
_rcc_inputs.push_back(entriesList);
}
// rcc options for this qrc file

View File

@ -441,49 +441,53 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
// - Rcc
if (this->RccEnabled()) {
InfoGet(makefile, "AM_RCC_SOURCES", this->RccSources);
// File options
{
std::vector<std::string> rccFilesVec;
std::vector<std::string> rccOptionsVec;
InfoGet(makefile, "AM_RCC_OPTIONS_FILES", rccFilesVec);
InfoGet(makefile, "AM_RCC_OPTIONS_OPTIONS", rccOptionsVec);
if (rccFilesVec.size() != rccOptionsVec.size()) {
for (std::vector<std::string>::iterator
fileIt = rccFilesVec.begin(),
optionIt = rccOptionsVec.begin();
fileIt != rccFilesVec.end(); ++fileIt, ++optionIt) {
// Replace item separator
cmSystemTools::ReplaceString(*optionIt,
cmQtAutoGeneratorCommon::listSep, ";");
this->RccOptions[*fileIt] = *optionIt;
}
} else {
this->LogError(
"AutoGen: Error: RCC files/options lists size missmatch in: " +
filename);
return false;
}
for (std::vector<std::string>::iterator fileIt = rccFilesVec.begin(),
optionIt = rccOptionsVec.begin();
fileIt != rccFilesVec.end(); ++fileIt, ++optionIt) {
cmSystemTools::ReplaceString(*optionIt,
cmQtAutoGeneratorCommon::listSep, ";");
this->RccOptions[*fileIt] = *optionIt;
}
}
// File lists
{
std::vector<std::string> rccInputLists;
InfoGet(makefile, "AM_RCC_INPUTS", rccInputLists);
// qrc files in the end of the list may have been empty
if (rccInputLists.size() < this->RccSources.size()) {
rccInputLists.resize(this->RccSources.size());
}
if (this->RccSources.size() != rccInputLists.size()) {
if (this->RccSources.size() == rccInputLists.size()) {
for (std::vector<std::string>::iterator
fileIt = this->RccSources.begin(),
inputIt = rccInputLists.begin();
fileIt != this->RccSources.end(); ++fileIt, ++inputIt) {
// Remove braces
*inputIt = inputIt->substr(1, inputIt->size() - 2);
// Replace item separator
cmSystemTools::ReplaceString(*inputIt,
cmQtAutoGeneratorCommon::listSep, ";");
std::vector<std::string> rccInputFiles;
cmSystemTools::ExpandListArgument(*inputIt, rccInputFiles);
this->RccInputs[*fileIt] = rccInputFiles;
}
} else {
this->LogError(
"AutoGen: Error: RCC sources/inputs lists size missmatch in: " +
filename);
return false;
}
for (std::vector<std::string>::iterator
fileIt = this->RccSources.begin(),
inputIt = rccInputLists.begin();
fileIt != this->RccSources.end(); ++fileIt, ++inputIt) {
cmSystemTools::ReplaceString(*inputIt,
cmQtAutoGeneratorCommon::listSep, ";");
std::vector<std::string> rccInputFiles;
cmSystemTools::ExpandListArgument(*inputIt, rccInputFiles);
this->RccInputs[*fileIt] = rccInputFiles;
}
}
}