From 09e398fa9f6e2a858780c78e3096a56e96a3dcb7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 16 Sep 2009 11:44:08 -0400 Subject: [PATCH] Create VS generator GetRegistryBase method This method returns the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\ A protected GetIDEVersion method retrieves the version-specific part of the key name. --- Source/cmGlobalVisualStudio10Generator.h | 2 ++ Source/cmGlobalVisualStudio6Generator.h | 3 +++ Source/cmGlobalVisualStudio71Generator.h | 1 + Source/cmGlobalVisualStudio7Generator.h | 2 ++ Source/cmGlobalVisualStudio8Generator.h | 1 + Source/cmGlobalVisualStudio9Generator.h | 2 ++ Source/cmGlobalVisualStudioGenerator.cxx | 8 ++++++++ Source/cmGlobalVisualStudioGenerator.h | 3 +++ 8 files changed, 22 insertions(+) diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 562b5465e..22351cd05 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/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 diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index ab023a389..91e79731a 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/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); diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index ed847e10e..22c5dd469 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/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, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index e04b05a29..54bb5e1b8 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/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& generators); diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 74ee3c716..11f33d356 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/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; } diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 0841603b2..ea31ab5fe 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -65,5 +65,7 @@ public: * Studio? */ virtual std::string GetUserMacrosRegKeyBase(); +protected: + virtual const char* GetIDEVersion() { return "9.0"; } }; #endif diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 43e3a81dc..6e9155251 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/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() { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index e7b8e467b..f471300af 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/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);