diff options
author | Oliver Wolff <oliver.wolff@theqtcompany.com> | 2015-04-30 11:14:21 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@theqtcompany.com> | 2015-05-04 13:15:30 +0000 |
commit | ac333d5d935b3f43e3c892e4abcecc125d424717 (patch) | |
tree | 9f0b9b2bbe415ccf0f94a6cfb75647b4671ddfa4 | |
parent | 70ea8ec678dfd945df7554f01d76a102fbc0e3e2 (diff) |
RefreshMocStep: Handle "standalone" header files containing Q_OBJECT properly
RefreshMocStep bailed out when it tried to obtain the cpp file's (that
does not exist) configuration in order to find includes, defines and pch
options. In order to be able to get these values (if applicable)
they are now fetched from the project configuration just like it is done
in AddMocStep.
Task-number: QTVSADDINBUG-399
Change-Id: I35ba5e29663e654e860fd3b3ec47d9be52eeda91
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r-- | Qt4VS2003/QtProjectLib/QtProject.cs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/Qt4VS2003/QtProjectLib/QtProject.cs b/Qt4VS2003/QtProjectLib/QtProject.cs index fee026c3..bd5de8bc 100644 --- a/Qt4VS2003/QtProjectLib/QtProject.cs +++ b/Qt4VS2003/QtProjectLib/QtProject.cs @@ -2807,9 +2807,21 @@ namespace Digia.Qt5ProjectLib bool mocableIsCPP = (srcMocFile == cppFile); string pchParameters = null; - VCFileConfiguration cppConfig = GetVCFileConfigurationByName(cppFile, config.Name); - CompilerToolWrapper compiler = CompilerToolWrapper.Create(cppConfig); - if (compiler.GetUsePrecompiledHeader() != pchOption.pchNone) + VCFileConfiguration defineIncludeConfig = null; + CompilerToolWrapper compiler = null; + if (cppFile == null) + { + // No file specific defines/includes but at least the project defines/includes are added + defineIncludeConfig = config; + compiler = CompilerToolWrapper.Create(config.ProjectConfiguration as VCConfiguration); + } + else + { + defineIncludeConfig = GetVCFileConfigurationByName(cppFile, config.Name); + compiler = CompilerToolWrapper.Create(defineIncludeConfig); + } + + if (compiler != null && compiler.GetUsePrecompiledHeader() != pchOption.pchNone) pchParameters = GetPCHMocOptions(srcMocFile, compiler); string outputFileName = QtVSIPSettings.GetMocDirectory(envPro) + "\\"; @@ -2826,8 +2838,8 @@ namespace Digia.Qt5ProjectLib } string newCmdLine = mocCmdChecker.NewCmdLine(tool.CommandLine, - GetIncludes(cppConfig), - GetDefines(cppConfig), + GetIncludes(defineIncludeConfig), + GetDefines(defineIncludeConfig), QtVSIPSettings.GetMocOptions(envPro), srcMocFile.RelativePath, pchParameters, outputFileName); |