cmGlobalVisualStudio9Generator.cxx 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "windows.h" // this must be first to define GetCurrentDirectory
  11. #include "cmGlobalVisualStudio9Generator.h"
  12. #include "cmLocalVisualStudio7Generator.h"
  13. #include "cmMakefile.h"
  14. #include "cmake.h"
  15. cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator()
  16. {
  17. this->VersionId = "MSVC90";
  18. this->FindMakeProgramFile = "CMakeVS9FindMake.cmake";
  19. }
  20. //----------------------------------------------------------------------------
  21. void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout)
  22. {
  23. fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n";
  24. fout << "# Visual Studio 2008\n";
  25. }
  26. ///! Create a local generator appropriate to this Global Generator
  27. cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
  28. {
  29. cmLocalVisualStudio7Generator *lg
  30. = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9);
  31. lg->SetPlatformName(this->GetPlatformName());
  32. lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
  33. lg->SetGlobalGenerator(this);
  34. return lg;
  35. }
  36. //----------------------------------------------------------------------------
  37. void cmGlobalVisualStudio9Generator
  38. ::GetDocumentation(cmDocumentationEntry& entry) const
  39. {
  40. entry.Name = this->GetName();
  41. entry.Brief = "Generates Visual Studio 9 2008 project files.";
  42. entry.Full = "";
  43. }
  44. //----------------------------------------------------------------------------
  45. void cmGlobalVisualStudio9Generator
  46. ::EnableLanguage(std::vector<std::string>const & lang,
  47. cmMakefile *mf, bool optional)
  48. {
  49. cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
  50. }
  51. //----------------------------------------------------------------------------
  52. std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory()
  53. {
  54. std::string base;
  55. std::string path;
  56. // base begins with the VisualStudioProjectsLocation reg value...
  57. if (cmSystemTools::ReadRegistryValue(
  58. "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;"
  59. "VisualStudioProjectsLocation",
  60. base))
  61. {
  62. cmSystemTools::ConvertToUnixSlashes(base);
  63. // 9.0 macros folder:
  64. path = base + "/VSMacros80";
  65. // *NOT* a typo; right now in Visual Studio 2008 beta the macros
  66. // folder is VSMacros80... They may change it to 90 before final
  67. // release of 2008 or they may not... we'll have to keep our eyes
  68. // on it
  69. }
  70. // path is (correctly) still empty if we did not read the base value from
  71. // the Registry value
  72. return path;
  73. }
  74. //----------------------------------------------------------------------------
  75. std::string cmGlobalVisualStudio9Generator::GetUserMacrosRegKeyBase()
  76. {
  77. return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros";
  78. }