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