diff options
author | Miguel Costa <miguel.costa@qt.io> | 2019-09-17 14:31:28 +0200 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2019-09-18 09:18:26 +0000 |
commit | 94f0425af0ccc9d73b4537c4b77f1adeebab5bbf (patch) | |
tree | af1c1f8cde1416e5c2677abc2a75bf40516055a9 | |
parent | 1c46c9ac9ff946e3d0d5a17676dd02dbd73a68ac (diff) |
Fix excluded-from-build removed by conversion
Fixed an issue in the conversion to Qt/MSBuild where moc-generated C++
sources excluded from build in the original project are included in the
converted project.
Task-number: QTVSADDINBUG-597
Change-Id: I1fbec901d744b0da3b4ad7d788e13a26182c151c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/qtmsbuild/moc/qtmoc.targets | 8 | ||||
-rw-r--r-- | src/qtprojectlib/MsBuildProject.cs | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/qtmsbuild/moc/qtmoc.targets b/src/qtmsbuild/moc/qtmoc.targets index 37d8c928..bffec544 100644 --- a/src/qtmsbuild/moc/qtmoc.targets +++ b/src/qtmsbuild/moc/qtmoc.targets @@ -397,6 +397,14 @@ <!-- /////////////////////////////////////////////////////////////////////////////////////////////// + // Add moc output dir to C++ include path + // --> + <ItemGroup> + <QtIncludePath Include="$([System.IO.Path]::GetDirectoryName('%(QtMoc.OutputFile)'))"/> + </ItemGroup> + + <!-- + /////////////////////////////////////////////////////////////////////////////////////////////// // Clean-up // --> <PropertyGroup> diff --git a/src/qtprojectlib/MsBuildProject.cs b/src/qtprojectlib/MsBuildProject.cs index 92b18cb6..09758e49 100644 --- a/src/qtprojectlib/MsBuildProject.cs +++ b/src/qtprojectlib/MsBuildProject.cs @@ -821,12 +821,20 @@ namespace QtProjectLib var outputItems = new List<XElement>(); foreach (var outputFile in outputFiles) { List<XElement> mocOutput = null; - if (projItemsByPath.TryGetValue(outputFile, out mocOutput)) + if (projItemsByPath.TryGetValue(outputFile, out mocOutput)) { outputItems.AddRange(mocOutput); + hasGeneratedFiles |= hasGeneratedFiles ? true : mocOutput + .Where(x => !x.Elements(ns + "ExcludedFromBuild") + .Where(y => + (string)y.Attribute("Condition") == string.Format( + "'$(Configuration)|$(Platform)'=='{0}'", configName) + && y.Value == "true") + .Any()) + .Any(); + } if (filterItemsByPath.TryGetValue(outputFile, out mocOutput)) outputItems.AddRange(mocOutput); } - hasGeneratedFiles = outputItems.Any(); foreach (var item in outputItems.Where(x => x.Parent != null)) item.Remove(); } |