cmGlobalVisualStudio9Generator.cxx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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->FindMakeProgramFile = "CMakeVS9FindMake.cmake";
  18. }
  19. //----------------------------------------------------------------------------
  20. void cmGlobalVisualStudio9Generator::AddPlatformDefinitions(cmMakefile* mf)
  21. {
  22. mf->AddDefinition("MSVC90", "1");
  23. }
  24. //----------------------------------------------------------------------------
  25. void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout)
  26. {
  27. fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n";
  28. fout << "# Visual Studio 2008\n";
  29. }
  30. ///! Create a local generator appropriate to this Global Generator
  31. cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
  32. {
  33. cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
  34. lg->SetVersion9();
  35. lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
  36. lg->SetGlobalGenerator(this);
  37. return lg;
  38. }
  39. //----------------------------------------------------------------------------
  40. void cmGlobalVisualStudio9Generator
  41. ::GetDocumentation(cmDocumentationEntry& entry) const
  42. {
  43. entry.Name = this->GetName();
  44. entry.Brief = "Generates Visual Studio 9 2008 project files.";
  45. entry.Full = "";
  46. }
  47. //----------------------------------------------------------------------------
  48. void cmGlobalVisualStudio9Generator
  49. ::EnableLanguage(std::vector<std::string>const & lang,
  50. cmMakefile *mf, bool optional)
  51. {
  52. cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
  53. }
  54. //----------------------------------------------------------------------------
  55. std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory()
  56. {
  57. std::string base;
  58. std::string path;
  59. // base begins with the VisualStudioProjectsLocation reg value...
  60. if (cmSystemTools::ReadRegistryValue(
  61. "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0;"
  62. "VisualStudioProjectsLocation",
  63. base))
  64. {
  65. cmSystemTools::ConvertToUnixSlashes(base);
  66. // 9.0 macros folder:
  67. path = base + "/VSMacros80";
  68. // *NOT* a typo; right now in Visual Studio 2008 beta the macros
  69. // folder is VSMacros80... They may change it to 90 before final
  70. // release of 2008 or they may not... we'll have to keep our eyes
  71. // on it
  72. }
  73. // path is (correctly) still empty if we did not read the base value from
  74. // the Registry value
  75. return path;
  76. }
  77. //----------------------------------------------------------------------------
  78. std::string cmGlobalVisualStudio9Generator::GetUserMacrosRegKeyBase()
  79. {
  80. return "Software\\Microsoft\\VisualStudio\\9.0\\vsmacros";
  81. }