make it possible to suppress warnings of the vcxproj generator

When the user adds a compiler option that qmake doesn't understand, a
warning message is printed. One can suppress these warnings now by
adding CONFIG+=suppress_vcproj_warnings to the project file.

Task-number: QTBUG-37520
Change-Id: Ieb7ad2c900329e76636047dff85824ea0456f608
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Joerg Bornemann 2014-09-12 17:34:57 +02:00
parent 1fb43025f2
commit 21f5d22f6f
3 changed files with 18 additions and 2 deletions

View File

@ -312,6 +312,18 @@ static QString vcCommandSeparator()
return cmdSep;
}
static void unknownOptionWarning(const char *tool, const char *option)
{
static bool firstCall = true;
warn_msg(WarnLogic, "Could not parse %s option '%s'; added to AdditionalOptions.", tool, option);
if (firstCall) {
firstCall = false;
warn_msg(WarnLogic,
"You can suppress these warnings with CONFIG+=suppress_vcproj_warnings.");
}
}
// VCCLCompilerTool -------------------------------------------------
VCCLCompilerTool::VCCLCompilerTool()
: AssemblerOutput(asmListingNone),
@ -1148,7 +1160,8 @@ bool VCCLCompilerTool::parseOption(const char* option)
break;
}
if(!found) {
warn_msg(WarnLogic, "Could not parse Compiler option: %s, added as AdditionalOption", option);
if (!config->suppressUnknownOptionWarnings)
unknownOptionWarning("Compiler", option);
AdditionalOptions += option;
}
return true;
@ -1743,7 +1756,8 @@ bool VCLinkerTool::parseOption(const char* option)
break;
}
if(!found) {
warn_msg(WarnLogic, "Could not parse Linker options: %s, added as AdditionalOption", option);
if (!config->suppressUnknownOptionWarnings)
unknownOptionWarning("Linker", option);
AdditionalOptions += option;
}
return found;

View File

@ -885,6 +885,7 @@ public:
VCConfiguration();
~VCConfiguration(){}
bool suppressUnknownOptionWarnings;
DotNET CompilerVersion;
bool WinRT, WinPhone, WinPhone80;

View File

@ -960,6 +960,7 @@ void VcprojGenerator::initConfiguration()
// - Do this first since main configuration elements may need
// - to know of certain compiler/linker options
VCConfiguration &conf = vcProject.Configuration;
conf.suppressUnknownOptionWarnings = project->isActiveConfig("suppress_vcproj_warnings");
conf.CompilerVersion = which_dotnet_version(project->first("MSVC_VER").toLatin1());
initCompilerTool();