浏览代码

Enumerate VS11 version explicitly in local generators

Since the parent commit the local generator Version ivar may be
compared for ordering.  Convert comparisons:

  "==VS10" becomes ">=VS10"
  "!=VS10" becomes "< VS10"

to support an explicit enumeration value for VS11 with no change
in behavior.
Brad King 14 年之前
父节点
当前提交
c92ffece80

+ 11 - 0
Source/cmGlobalVisualStudio11Generator.cxx

@@ -10,6 +10,7 @@
   See the License for more information.
 ============================================================================*/
 #include "cmGlobalVisualStudio11Generator.h"
+#include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
 
 //----------------------------------------------------------------------------
@@ -35,6 +36,16 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
   fout << "# Visual Studio 11\n";
 }
 
+//----------------------------------------------------------------------------
+cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator()
+{
+  cmLocalVisualStudio10Generator* lg =
+    new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11);
+  lg->SetPlatformName(this->GetPlatformName());
+  lg->SetGlobalGenerator(this);
+  return lg;
+}
+
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio11Generator
 ::GetDocumentation(cmDocumentationEntry& entry) const

+ 3 - 0
Source/cmGlobalVisualStudio11Generator.h

@@ -35,6 +35,9 @@ public:
   /** Get the documentation entry for this generator.  */
   virtual void GetDocumentation(cmDocumentationEntry& entry) const;
 
+  ///! create the correct local generator
+  virtual cmLocalGenerator *CreateLocalGenerator();
+
   /** TODO: VS 11 user macro support. */
   virtual std::string GetUserMacrosDirectory() { return ""; }
 protected:

+ 2 - 1
Source/cmLocalVisualStudioGenerator.h

@@ -37,7 +37,8 @@ public:
     VS71 = 71,
     VS8 = 80,
     VS9 = 90,
-    VS10 = 100
+    VS10 = 100,
+    VS11 = 110
   };
 
   cmLocalVisualStudioGenerator(VSVersion v);

+ 7 - 6
Source/cmVisualStudioGeneratorOptions.cxx

@@ -65,6 +65,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault()
       this->FlagMap["ExceptionHandling"] = "FALSE";
       break;
     case cmLocalVisualStudioGenerator::VS10:
+    case cmLocalVisualStudioGenerator::VS11:
       // by default VS puts <ExceptionHandling></ExceptionHandling> empty
       // for a project, to make our projects look the same put a new line
       // and space over for the closing </ExceptionHandling> as the default
@@ -211,7 +212,7 @@ cmVisualStudioGeneratorOptions
     {
     return;
     }
-  if(this->Version == cmLocalVisualStudioGenerator::VS10)
+  if(this->Version >= cmLocalVisualStudioGenerator::VS10)
     {
     // if there are configuration specifc flags, then
     // use the configuration specific tag for PreprocessorDefinitions
@@ -239,7 +240,7 @@ cmVisualStudioGeneratorOptions
     {
     // Escape the definition for the compiler.
     std::string define;
-    if(this->Version != cmLocalVisualStudioGenerator::VS10)
+    if(this->Version < cmLocalVisualStudioGenerator::VS10)
       {
       define =
         this->LocalGenerator->EscapeForShell(di->c_str(), true);
@@ -249,7 +250,7 @@ cmVisualStudioGeneratorOptions
       define = *di;
       }
     // Escape this flag for the IDE.
-    if(this->Version == cmLocalVisualStudioGenerator::VS10)
+    if(this->Version >= cmLocalVisualStudioGenerator::VS10)
       {
       define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str());
 
@@ -266,7 +267,7 @@ cmVisualStudioGeneratorOptions
     fout << sep << define;
     sep = ";";
     }
-  if(this->Version == cmLocalVisualStudioGenerator::VS10)
+  if(this->Version >= cmLocalVisualStudioGenerator::VS10)
     {
     fout <<  ";%(PreprocessorDefinitions)</PreprocessorDefinitions>" << suffix;
     }
@@ -281,7 +282,7 @@ void
 cmVisualStudioGeneratorOptions
 ::OutputFlagMap(std::ostream& fout, const char* indent)
 {
-  if(this->Version == cmLocalVisualStudioGenerator::VS10)
+  if(this->Version >= cmLocalVisualStudioGenerator::VS10)
     {
     for(std::map<cmStdString, cmStdString>::iterator m = this->FlagMap.begin();
         m != this->FlagMap.end(); ++m)
@@ -326,7 +327,7 @@ cmVisualStudioGeneratorOptions
 {
   if(!this->FlagString.empty())
     {
-    if(this->Version == cmLocalVisualStudioGenerator::VS10)
+    if(this->Version >= cmLocalVisualStudioGenerator::VS10)
       { 
       fout << prefix;
       if(this->Configuration.size())