cmGlobalVisualStudio9Generator.cxx 3.2 KB

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