--- Source/cmLocalVisualStudio7Generator.cxx	Mon Nov 20 14:46:26 2006
+++ Source/cmLocalVisualStudio7Generator.cxx	Tue Nov 28 20:50:18 2006
@@ -500,6 +500,14 @@
   // this function call
   this->FillFlagMapFromCommandFlags
     (flagMap, &cmLocalVisualStudio7GeneratorFlagTable[0], flags);
+  
+  // if "Optimization" attribute is missing, Visual Studio defaults
+  // to "Maximize Speed" rather than "Custom".
+  if (flagMap.find("Optimization") == flagMap.end())
+    {
+    flagMap["Optimization"] = "4"; // custom optimization
+    }
+	
   std::string defineFlags = this->Makefile->GetDefineFlags();
 
   // now check the define flags for flags other than -D and
