diff options
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; |