From e2341226938857c4b32aa976587fa18cca230a1c Mon Sep 17 00:00:00 2001 From: Robert Goulet Date: Thu, 19 Aug 2010 09:21:54 -0400 Subject: [PATCH] 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". --- Source/cmVisualStudio10TargetGenerator.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 59e20d50c..ca522bb32 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -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("" + "\n", 3); + } + clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n"); this->WriteString("", 3);