Explorar el Código

Create VS generator GetRegistryBase method

This method returns the registry key

  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<version>

A protected GetIDEVersion method retrieves the version-specific part of
the key name.
Brad King hace 16 años
padre
commit
09e398fa9f

+ 2 - 0
Source/cmGlobalVisualStudio10Generator.h

@@ -73,5 +73,7 @@ public:
   virtual std::string GetUserMacrosRegKeyBase();
   virtual const char* GetCMakeCFGInitDirectory() 
     { return "$(ConfigurationName)";} 
+protected:
+  virtual const char* GetIDEVersion() { return "10.0"; }
 };
 #endif

+ 3 - 0
Source/cmGlobalVisualStudio6Generator.h

@@ -88,6 +88,9 @@ public:
 
   ///! What is the configurations directory variable called?
   virtual const char* GetCMakeCFGInitDirectory()  { return "$(IntDir)"; }
+
+protected:
+  virtual const char* GetIDEVersion() { return "6.0"; }
 private:
   void GenerateConfigurations(cmMakefile* mf);
   void WriteDSWFile(std::ostream& fout);

+ 1 - 0
Source/cmGlobalVisualStudio71Generator.h

@@ -57,6 +57,7 @@ public:
   virtual std::string GetUserMacrosRegKeyBase();
 
 protected:
+  virtual const char* GetIDEVersion() { return "7.1"; }
   virtual void AddPlatformDefinitions(cmMakefile* mf);
   virtual void WriteSLNFile(std::ostream& fout, 
                             cmLocalGenerator* root,

+ 2 - 0
Source/cmGlobalVisualStudio7Generator.h

@@ -103,6 +103,8 @@ public:
   };
 
 protected:
+  virtual const char* GetIDEVersion() { return "7.0"; }
+
   static cmIDEFlagTable const* GetExtraFlagTableVS7();
   virtual void OutputSLNFile(cmLocalGenerator* root, 
                              std::vector<cmLocalGenerator*>& generators);

+ 1 - 0
Source/cmGlobalVisualStudio8Generator.h

@@ -64,6 +64,7 @@ public:
   virtual std::string GetUserMacrosRegKeyBase();
 
 protected:
+  virtual const char* GetIDEVersion() { return "8.0"; }
 
   virtual bool VSLinksDependencies() const { return false; }
 

+ 2 - 0
Source/cmGlobalVisualStudio9Generator.h

@@ -65,5 +65,7 @@ public:
    * Studio?
    */
   virtual std::string GetUserMacrosRegKeyBase();
+protected:
+  virtual const char* GetIDEVersion() { return "9.0"; }
 };
 #endif

+ 8 - 0
Source/cmGlobalVisualStudioGenerator.cxx

@@ -31,6 +31,14 @@ cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator()
 {
 }
 
+//----------------------------------------------------------------------------
+std::string cmGlobalVisualStudioGenerator::GetRegistryBase()
+{
+  std::string key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
+  key += this->GetIDEVersion();
+  return key;
+}
+
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudioGenerator::Generate()
 {

+ 3 - 0
Source/cmGlobalVisualStudioGenerator.h

@@ -68,6 +68,8 @@ public:
   bool TargetIsFortranOnly(cmTarget& t);
   const char* GetUtilityForTarget(cmTarget& target, const char*);
 
+  /** Get the top-level registry key for this VS version.  */
+  std::string GetRegistryBase();
 protected:
   void FixUtilityDepends();
 
@@ -76,6 +78,7 @@ protected:
   // below 8.
   virtual bool VSLinksDependencies() const { return true; }
 
+  virtual const char* GetIDEVersion() = 0;
 private:
   void FixUtilityDependsForTarget(cmTarget& target);
   void CreateUtilityDependTarget(cmTarget& target);