diff options
author | David Cole <david.cole@kitware.com> | 2008-02-15 11:49:58 -0500 |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2008-02-15 11:49:58 -0500 |
commit | ca2a16c0a221bb0c3be4491125c044c9112836e0 (patch) | |
tree | 38e2fab8d33aaf4915039dede364d6d34d815744 /Source/cmGlobalVisualStudioGenerator.cxx | |
parent | ed76198b840b83d49ee4eba9ca0c7753b41d54cf (diff) | |
download | cmake-ca2a16c0a221bb0c3be4491125c044c9112836e0.tar.gz |
ENH: Add code to support calling the VS reload macro from Visual Studio 7.1 and 9.0 in addition to 8.0 sp1... Make new macros file with VS 7.1 so that it can be read by 7.1 and later. VS 7.1 does not appear to run the macros while a build is in progress, but does not return any errors either, so for now, the reload macro is not called when using 7.1. If I can figure out how to get 7.1 to execute the macro, I will uncomment the code in cmGlobalVisualStudio71Generator::GetUserMacrosDirectory() to activate executing the macros in VS 7.1, too.
Diffstat (limited to 'Source/cmGlobalVisualStudioGenerator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index b824590cb2..efa9adfbc5 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -68,19 +68,21 @@ void cmGlobalVisualStudioGenerator::Generate() //---------------------------------------------------------------------------- bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, + const std::string& regKeyBase, std::string& nextAvailableSubKeyName); -void RegisterVisualStudioMacros(const std::string& macrosFile); +void RegisterVisualStudioMacros(const std::string& macrosFile, + const std::string& regKeyBase); //---------------------------------------------------------------------------- #define CMAKE_VSMACROS_FILENAME \ - "CMakeVSMacros1.vsmacros" + "CMakeVSMacros2.vsmacros" #define CMAKE_VSMACROS_RELOAD_MACRONAME \ - "Macros.CMakeVSMacros1.Macros.ReloadProjects" + "Macros.CMakeVSMacros2.Macros.ReloadProjects" #define CMAKE_VSMACROS_STOP_MACRONAME \ - "Macros.CMakeVSMacros1.Macros.StopBuild" + "Macros.CMakeVSMacros2.Macros.StopBuild" //---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros() @@ -113,7 +115,7 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros() } } - RegisterVisualStudioMacros(dst); + RegisterVisualStudioMacros(dst, this->GetUserMacrosRegKeyBase()); } } @@ -140,7 +142,8 @@ cmGlobalVisualStudioGenerator std::string macrosFile = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME; std::string nextSubkeyName; if (cmSystemTools::FileExists(macrosFile.c_str()) && - IsVisualStudioMacrosFileRegistered(macrosFile, nextSubkeyName) + IsVisualStudioMacrosFileRegistered(macrosFile, + this->GetUserMacrosRegKeyBase(), nextSubkeyName) ) { std::string topLevelSlnName; @@ -195,6 +198,12 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosDirectory() } //---------------------------------------------------------------------------- +std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase() +{ + return ""; +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator::FixUtilityDepends() { // Skip for VS versions 8 and above. @@ -396,6 +405,7 @@ cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target, //---------------------------------------------------------------------------- bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, + const std::string& regKeyBase, std::string& nextAvailableSubKeyName) { bool macrosRegistered = false; @@ -413,8 +423,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, LONG result = ERROR_SUCCESS; DWORD index = 0; - keyname = - "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\OtherProjects7"; + keyname = regKeyBase + "\\OtherProjects7"; hkey = NULL; result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(), 0, KEY_READ, &hkey); @@ -517,8 +526,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, nextAvailableSubKeyName = ossNext.str(); - keyname = - "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\RecordingProject7"; + keyname = regKeyBase + "\\RecordingProject7"; hkey = NULL; result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(), 0, KEY_READ, &hkey); @@ -567,10 +575,10 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, //---------------------------------------------------------------------------- void WriteVSMacrosFileRegistryEntry( const std::string& nextAvailableSubKeyName, - const std::string& macrosFile) + const std::string& macrosFile, + const std::string& regKeyBase) { - std::string keyname = - "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros\\OtherProjects7"; + std::string keyname = regKeyBase + "\\OtherProjects7"; HKEY hkey = NULL; LONG result = RegOpenKeyEx(HKEY_CURRENT_USER, keyname.c_str(), 0, KEY_READ|KEY_WRITE, &hkey); @@ -634,13 +642,14 @@ void WriteVSMacrosFileRegistryEntry( } //---------------------------------------------------------------------------- -void RegisterVisualStudioMacros(const std::string& macrosFile) +void RegisterVisualStudioMacros(const std::string& macrosFile, + const std::string& regKeyBase) { bool macrosRegistered; std::string nextAvailableSubKeyName; macrosRegistered = IsVisualStudioMacrosFileRegistered(macrosFile, - nextAvailableSubKeyName); + regKeyBase, nextAvailableSubKeyName); if (!macrosRegistered) { @@ -681,7 +690,7 @@ void RegisterVisualStudioMacros(const std::string& macrosFile) // if (0 == count) { - IsVisualStudioMacrosFileRegistered(macrosFile, + IsVisualStudioMacrosFileRegistered(macrosFile, regKeyBase, nextAvailableSubKeyName); } } @@ -690,7 +699,8 @@ void RegisterVisualStudioMacros(const std::string& macrosFile) // if (0 == count) { - WriteVSMacrosFileRegistryEntry(nextAvailableSubKeyName, macrosFile); + WriteVSMacrosFileRegistryEntry(nextAvailableSubKeyName, macrosFile, + regKeyBase); } } } |