diff options
author | Miguel Costa <miguel.costa@qt.io> | 2017-12-19 15:15:49 +0100 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2017-12-22 08:52:09 +0000 |
commit | 28955625a024d212758ca992c250ecf8f18462f3 (patch) | |
tree | 6b3752e62142f2c7b9408446eb038b3ba25a874c /src/qtprojectlib/QtProject.cs | |
parent | 0d81d9e19cd5ab8435bb6247399af865217f1f61 (diff) |
Fix bugs in handling of .cpp moc source
Reworked the property definition strategy for Qt/MSBuild properties
(i.e. deciding when to set properties at project or item level). The
previous approach did not handle correctly the case of .cpp moc files.
Also fixed a bug in RefreshMocStep that was causing build failure with
.cpp moc files when the moc output path was modified in the Qt Project
Settings dialog.
Change-Id: Icae4ffa7aa42e679a4cfcb87ee866dc8f7f01cf6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/qtprojectlib/QtProject.cs')
-rw-r--r-- | src/qtprojectlib/QtProject.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/qtprojectlib/QtProject.cs b/src/qtprojectlib/QtProject.cs index 69d18b9a..54aef57b 100644 --- a/src/qtprojectlib/QtProject.cs +++ b/src/qtprojectlib/QtProject.cs @@ -2575,7 +2575,7 @@ namespace QtProjectLib VCCustomBuildTool tool = null; VCFile mocable = null; var customBuildConfig = config; - if (isHeaderFile) { + if (isHeaderFile || vcfile.ItemType == QtMoc.ItemTypeName) { mocable = vcfile; if (vcfile.ItemType == "CustomBuild") tool = HelperFunctions.GetCustomBuildTool(config); @@ -2619,12 +2619,22 @@ namespace QtProjectLib StringComparison.OrdinalIgnoreCase) == -1) continue; - var srcMocFile = GetSourceFileForMocStep(mocable); - var cppFile = GetCppFileForMocStep(mocable); + VCFile srcMocFile, cppFile; + if (vcfile.ItemType == QtMoc.ItemTypeName + && HelperFunctions.IsSourceFile(vcfile.ItemName)) { + srcMocFile = cppFile = vcfile; + } else { + srcMocFile = GetSourceFileForMocStep(mocable); + cppFile = GetCppFileForMocStep(mocable); + } if (srcMocFile == null) continue; var mocableIsCPP = (srcMocFile == cppFile); + var cppItemType = (cppFile != null) ? cppFile.ItemType : ""; + if (cppFile != null && cppItemType != "ClCompile") + cppFile.ItemType = "ClCompile"; + string pchParameters = null; VCFileConfiguration defineIncludeConfig = null; CompilerToolWrapper compiler = null; @@ -2658,6 +2668,9 @@ namespace QtProjectLib pchParameters, outputFileName); + if (cppFile != null && cppItemType != "ClCompile") + cppFile.ItemType = cppItemType; + // The tool's command line automatically gets a trailing "\r\n". // We have to remove it to make the check below work. var origCommandLine = commandLine; |