summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio11Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-28 14:08:11 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-28 17:43:14 (GMT)
commit29071fed2efbc7857f3994ac746641a4c5a36b9d (patch)
tree9a03032b070863099f98867b920bbb78d741b7b7 /Source/cmGlobalVisualStudio11Generator.cxx
parent16df2456a440d87fb3e8e53fb59a2817b288b9af (diff)
downloadCMake-29071fed2efbc7857f3994ac746641a4c5a36b9d.zip
CMake-29071fed2efbc7857f3994ac746641a4c5a36b9d.tar.gz
CMake-29071fed2efbc7857f3994ac746641a4c5a36b9d.tar.bz2
VS: Add version year to generator names
Rename the Visual Studio >= 10 generators to indicate the version year: Visual Studio 10 => Visual Studio 10 2010 Visual Studio 11 => Visual Studio 11 2012 Visual Studio 12 => Visual Stduio 12 2013 Report the names with the year to the list of available generators so that the cmake-gui drop-down shows the years. When selecting a generator from the "-G" option or from an existing CMAKE_GENERATOR cache entry, recognize names without the years for compatibility and map them to the names with years. Update the generator names in the cmake-generators.7 manual.
Diffstat (limited to 'Source/cmGlobalVisualStudio11Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx80
1 files changed, 53 insertions, 27 deletions
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 41a349e..d968c6d 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -13,42 +13,54 @@
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
-static const char vs11generatorName[] = "Visual Studio 11";
+static const char vs11generatorName[] = "Visual Studio 11 2012";
+
+// Map generator name without year to name with year.
+static const char* cmVS11GenName(const char* name, std::string& genName)
+{
+ if(strncmp(name, vs11generatorName, sizeof(vs11generatorName)-6) != 0)
+ {
+ return 0;
+ }
+ const char* p = name + sizeof(vs11generatorName) - 6;
+ if(strncmp(p, " 2012", 5) == 0)
+ {
+ p += 5;
+ }
+ genName = std::string(vs11generatorName) + p;
+ return p;
+}
class cmGlobalVisualStudio11Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
- if(strstr(name, vs11generatorName) != name)
- {
- return 0;
- }
-
- const char* p = name + sizeof(vs11generatorName) - 1;
- if(p[0] == '\0')
+ virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+ {
+ std::string genName;
+ const char* p = cmVS11GenName(name, genName);
+ if(!p)
+ { return 0; }
+ name = genName.c_str();
+ if(strcmp(p, "") == 0)
{
return new cmGlobalVisualStudio11Generator(
name, NULL, NULL);
}
-
- if(p[0] != ' ')
+ if(strcmp(p, " Win64") == 0)
{
- return 0;
+ return new cmGlobalVisualStudio11Generator(
+ name, "x64", "CMAKE_FORCE_WIN64");
}
-
- ++p;
-
- if(!strcmp(p, "ARM"))
+ if(strcmp(p, " ARM") == 0)
{
return new cmGlobalVisualStudio11Generator(
name, "ARM", NULL);
}
- if(!strcmp(p, "Win64"))
+ if(*p++ != ' ')
{
- return new cmGlobalVisualStudio11Generator(
- name, "x64", "CMAKE_FORCE_WIN64");
+ return 0;
}
std::set<std::string> installedSDKs =
@@ -63,14 +75,16 @@ public:
new cmGlobalVisualStudio11Generator(name, p, NULL);
ret->WindowsCEVersion = "8.00";
return ret;
- }
+ }
- virtual void GetDocumentation(cmDocumentationEntry& entry) const {
- entry.Name = "Visual Studio 11";
- entry.Brief = "Generates Visual Studio 11 (2012) project files.";
- }
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ {
+ entry.Name = vs11generatorName;
+ entry.Brief = "Generates Visual Studio 11 (VS 2012) project files.";
+ }
- virtual void GetGenerators(std::vector<std::string>& names) const {
+ virtual void GetGenerators(std::vector<std::string>& names) const
+ {
names.push_back(vs11generatorName);
names.push_back(vs11generatorName + std::string(" ARM"));
names.push_back(vs11generatorName + std::string(" Win64"));
@@ -80,9 +94,9 @@ public:
for(std::set<std::string>::const_iterator i =
installedSDKs.begin(); i != installedSDKs.end(); ++i)
{
- names.push_back("Visual Studio 11 " + *i);
+ names.push_back(std::string(vs11generatorName) + " " + *i);
}
- }
+ }
};
//----------------------------------------------------------------------------
@@ -107,6 +121,18 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
}
//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio11Generator::MatchesGeneratorName(const char* name) const
+{
+ std::string genName;
+ if(cmVS11GenName(name, genName))
+ {
+ return genName == this->GetName();
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
{
fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";