cmGlobalVisualStudio9Generator.cxx 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "windows.h" // this must be first to define GetCurrentDirectory
  14. #include "cmGlobalVisualStudio9Generator.h"
  15. #include "cmLocalVisualStudio7Generator.h"
  16. #include "cmMakefile.h"
  17. #include "cmake.h"
  18. cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator()
  19. {
  20. this->FindMakeProgramFile = "CMakeVS9FindMake.cmake";
  21. }
  22. void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout)
  23. {
  24. fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n";
  25. fout << "# Visual Studio 2008\n";
  26. }
  27. ///! Create a local generator appropriate to this Global Generator
  28. cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
  29. {
  30. cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
  31. lg->SetVersion9();
  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. }