summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-02-12 10:08:19 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-02-13 12:34:31 +0000
commitb8a162ee97b4b4a225101cf7848e04810766c434 (patch)
tree28590d724a4c885ea9ac67629e34add9a10c6b9a /qmake
parent7af4d5da90182e399db900b112b0fe1263935281 (diff)
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>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index ee92efe42f..e6be3334e4 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -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,