1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2011 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 "cmGlobalVisualStudio12Generator.h"
13 #include "cmLocalVisualStudio10Generator.h"
14 #include "cmMakefile.h"
16 static const char vs12Win32generatorName[] = "Visual Studio 12";
17 static const char vs12Win64generatorName[] = "Visual Studio 12 Win64";
18 static const char vs12ARMgeneratorName[] = "Visual Studio 12 ARM";
20 class cmGlobalVisualStudio12Generator::Factory
21 : public cmGlobalGeneratorFactory
24 virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
25 if(!strcmp(name, vs12Win32generatorName))
27 return new cmGlobalVisualStudio12Generator(
30 if(!strcmp(name, vs12Win64generatorName))
32 return new cmGlobalVisualStudio12Generator(
33 name, "x64", "CMAKE_FORCE_WIN64");
35 if(!strcmp(name, vs12ARMgeneratorName))
37 return new cmGlobalVisualStudio12Generator(
43 virtual void GetDocumentation(cmDocumentationEntry& entry) const {
44 entry.Name = "Visual Studio 12";
45 entry.Brief = "Generates Visual Studio 12 (2013) project files.";
47 "It is possible to append a space followed by the platform name "
48 "to create project files for a specific target platform. E.g. "
49 "\"Visual Studio 12 Win64\" will create project files for "
50 "the x64 processor; \"Visual Studio 12 ARM\" for ARM.";
53 virtual void GetGenerators(std::vector<std::string>& names) const {
54 names.push_back(vs12Win32generatorName);
55 names.push_back(vs12Win64generatorName);
56 names.push_back(vs12ARMgeneratorName); }
59 //----------------------------------------------------------------------------
60 cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
65 //----------------------------------------------------------------------------
66 cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
67 const char* name, const char* platformName,
68 const char* additionalPlatformDefinition)
69 : cmGlobalVisualStudio11Generator(name, platformName,
70 additionalPlatformDefinition)
72 this->FindMakeProgramFile = "CMakeVS12FindMake.cmake";
73 std::string vc12Express;
74 this->ExpressEdition = cmSystemTools::ReadRegistryValue(
75 "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;"
76 "ProductDir", vc12Express, cmSystemTools::KeyWOW64_32);
77 this->PlatformToolset = "v120";
80 //----------------------------------------------------------------------------
81 void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout)
83 fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
84 if (this->ExpressEdition)
86 fout << "# Visual Studio Express 2013 for Windows Desktop\n";
90 fout << "# Visual Studio 2013\n";
94 //----------------------------------------------------------------------------
95 cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator()
97 cmLocalVisualStudio10Generator* lg =
98 new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12);
99 lg->SetPlatformName(this->GetPlatformName());
100 lg->SetGlobalGenerator(this);