fix vcxproj generation for CONFIG-=flat
Commit 4f21eb03
broke the generation of non-flat vcxprojs.
XTreeNode passes filter names to outputFileConfigs that have
the source subdirectory suffixed (e.g. "Generated Files\subdir").
Function filterByName must be called with the substring before the
backslash.
Change-Id: Ic259e6316ab0727828773b13e0d8ad0cc7f0808f
Task-number: QTBUG-41746
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
parent
7af4d5da90
commit
b8a162ee97
@ -1854,17 +1854,26 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu
|
||||
root->generateXML(xml, xmlFilter, "", project, filtername); // output root tree
|
||||
}
|
||||
|
||||
static QString stringBeforeFirstBackslash(const QString &str)
|
||||
{
|
||||
int idx = str.indexOf(QLatin1Char('\\'));
|
||||
return idx == -1 ? str : str.left(idx);
|
||||
}
|
||||
|
||||
// Output all configurations (by filtername) for a file (by info)
|
||||
// A filters config output is in VCFilter.outputFileConfig()
|
||||
void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter,
|
||||
const VCFilterFile &info, const QString &filtername)
|
||||
{
|
||||
// In non-flat mode the filter names have directory suffixes, e.g. "Generated Files\subdir".
|
||||
const QString cleanFilterName = stringBeforeFirstBackslash(filtername);
|
||||
|
||||
// We need to check if the file has any custom build step.
|
||||
// If there is one then it has to be included with "CustomBuild Include"
|
||||
bool hasCustomBuildStep = false;
|
||||
QVarLengthArray<OutputFilterData> data(project.SingleProjects.count());
|
||||
for (int i = 0; i < project.SingleProjects.count(); ++i) {
|
||||
data[i].filter = project.SingleProjects.at(i).filterByName(filtername);
|
||||
data[i].filter = project.SingleProjects.at(i).filterByName(cleanFilterName);
|
||||
if (!data[i].filter.Config) // only if the filter is not empty
|
||||
continue;
|
||||
VCFilter &filter = data[i].filter;
|
||||
@ -1886,7 +1895,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
|
||||
|
||||
bool fileAdded = false;
|
||||
for (int i = 0; i < project.SingleProjects.count(); ++i) {
|
||||
const VCFilter &filter = project.SingleProjects.at(i).filterByName(filtername);
|
||||
const VCFilter &filter = project.SingleProjects.at(i).filterByName(cleanFilterName);
|
||||
if (!filter.Config) // only if the filter is not empty
|
||||
continue;
|
||||
if (outputFileConfig(&data[i], xml, xmlFilter, info.file, fileAdded,
|
||||
|
Loading…
Reference in New Issue
Block a user