VS2010: Disable PDBs when there is no debug info

When none of the options /Z7, /Zi and /ZI are specified in the cmake
project settings, the project will open in the editor with "Program
Database" as the default debug information format, ending up always
generating PDBs regardless of project configuration.

Modify the output project file so that if the debug information format
is not specified in the cmake project settings it will default to no PDB
generated, just like all the previous other Visual Studio versions.
This problem comes from the fact that Microsoft changed the default
setting of the debug information format to be "Program Database" instead
of "Disabled".
This commit is contained in:
Robert Goulet 2010-08-19 09:21:54 -04:00 committed by Brad King
parent b29cd51147
commit e234122693
1 changed files with 9 additions and 0 deletions

View File

@ -1033,6 +1033,15 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
this->OutputIncludes(includes);
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
// If not in debug mode, write the DebugInformationFormat field
// without value so PDBs don't get generated uselessly.
if(!clOptions.IsDebug())
{
this->WriteString("<DebugInformationFormat>"
"</DebugInformationFormat>\n", 3);
}
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n");
this->WriteString("<AssemblerListingLocation>", 3);