summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio12Generator.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/cmGlobalVisualStudio12Generator.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/cmGlobalVisualStudio12Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx67
1 files changed, 51 insertions, 16 deletions
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index c2cdc0b..f3806df 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -13,42 +13,65 @@
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
-static const char vs12Win32generatorName[] = "Visual Studio 12";
-static const char vs12Win64generatorName[] = "Visual Studio 12 Win64";
-static const char vs12ARMgeneratorName[] = "Visual Studio 12 ARM";
+static const char vs12generatorName[] = "Visual Studio 12 2013";
+
+// Map generator name without year to name with year.
+static const char* cmVS12GenName(const char* name, std::string& genName)
+{
+ if(strncmp(name, vs12generatorName, sizeof(vs12generatorName)-6) != 0)
+ {
+ return 0;
+ }
+ const char* p = name + sizeof(vs12generatorName) - 6;
+ if(strncmp(p, " 2013", 5) == 0)
+ {
+ p += 5;
+ }
+ genName = std::string(vs12generatorName) + p;
+ return p;
+}
class cmGlobalVisualStudio12Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
- if(!strcmp(name, vs12Win32generatorName))
+ virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+ {
+ std::string genName;
+ const char* p = cmVS12GenName(name, genName);
+ if(!p)
+ { return 0; }
+ name = genName.c_str();
+ if(strcmp(p, "") == 0)
{
return new cmGlobalVisualStudio12Generator(
name, NULL, NULL);
}
- if(!strcmp(name, vs12Win64generatorName))
+ if(strcmp(p, " Win64") == 0)
{
return new cmGlobalVisualStudio12Generator(
name, "x64", "CMAKE_FORCE_WIN64");
}
- if(!strcmp(name, vs12ARMgeneratorName))
+ if(strcmp(p, " ARM") == 0)
{
return new cmGlobalVisualStudio12Generator(
name, "ARM", NULL);
}
return 0;
- }
+ }
- virtual void GetDocumentation(cmDocumentationEntry& entry) const {
- entry.Name = "Visual Studio 12";
- entry.Brief = "Generates Visual Studio 12 (2013) project files.";
- }
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ {
+ entry.Name = vs12generatorName;
+ entry.Brief = "Generates Visual Studio 12 (VS 2013) project files.";
+ }
- virtual void GetGenerators(std::vector<std::string>& names) const {
- names.push_back(vs12Win32generatorName);
- names.push_back(vs12Win64generatorName);
- names.push_back(vs12ARMgeneratorName); }
+ virtual void GetGenerators(std::vector<std::string>& names) const
+ {
+ names.push_back(vs12generatorName);
+ names.push_back(vs12generatorName + std::string(" ARM"));
+ names.push_back(vs12generatorName + std::string(" Win64"));
+ }
};
//----------------------------------------------------------------------------
@@ -73,6 +96,18 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
}
//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio12Generator::MatchesGeneratorName(const char* name) const
+{
+ std::string genName;
+ if(cmVS12GenName(name, genName))
+ {
+ return genName == this->GetName();
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout)
{
fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";