fix vcxproj generation for CONFIG-=flat, part II

Commit 8ee2e497 introduced a regression for CONFIG-=flat vcxproj files.
Files with custom build steps (e.g. foo.h with Q_OBJECT) were written
into top-level filters ("Header Files" instead of
"Header Files\my\sub\dir").
The assumption that the parameter filtername always equals
VCFilter::name was wrong.

Change-Id: Id5178550310d06b73e42f18597a27012ddd89bb7
Task-number: QTBUG-44413
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Joerg Bornemann 2015-02-12 10:54:56 +01:00
parent 405bdee0c9
commit f90c186058
2 changed files with 10 additions and 6 deletions

View File

@ -1898,8 +1898,10 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
OutputFilterData *d = &data[i];
if (!d->filter.Config) // only if the filter is not empty
continue;
if (outputFileConfig(d, xml, xmlFilter, info.file, fileAdded, hasCustomBuildStep))
if (outputFileConfig(d, xml, xmlFilter, info.file, filtername, fileAdded,
hasCustomBuildStep)) {
fileAdded = true;
}
}
if ( !fileAdded )
@ -1910,8 +1912,8 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
}
bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter,
const QString &filename, bool fileAdded,
bool hasCustomBuildStep)
const QString &filename, const QString &fullFilterName,
bool fileAdded, bool hasCustomBuildStep)
{
VCFilter &filter = d->filter;
if (d->inBuild) {
@ -1934,7 +1936,7 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml
xmlFilter << tag("CustomBuild")
<< attrTag("Include",Option::fixPathToLocalOS(filename))
<< attrTagS("Filter", filter.Name);
<< attrTagS("Filter", fullFilterName);
xml << tag("CustomBuild")
<< attrTag("Include",Option::fixPathToLocalOS(filename));
@ -1952,7 +1954,7 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml
if (!fileAdded)
{
fileAdded = true;
outputFileConfig(xml, xmlFilter, filename, filter.Name);
outputFileConfig(xml, xmlFilter, filename, fullFilterName);
}
const QString condition = generateCondition(*filter.Config);

View File

@ -185,7 +185,9 @@ private:
static void outputFilter(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filtername);
static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter,
const VCFilterFile &info, const QString &filtername);
static bool outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, bool fileAdded, bool hasCustomBuildStep);
static bool outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter,
const QString &filename, const QString &fullFilterName,
bool fileAdded, bool hasCustomBuildStep);
static void outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &fileName, const QString &filterName);
static QString generateCondition(const VCConfiguration &config);