summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio10Generator.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/cmGlobalVisualStudio10Generator.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/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx67
1 files changed, 51 insertions, 16 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 07ccc33..5e29fd7 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -18,42 +18,65 @@
#include "cmVisualStudioSlnParser.h"
#include "cmake.h"
-static const char vs10Win32generatorName[] = "Visual Studio 10";
-static const char vs10Win64generatorName[] = "Visual Studio 10 Win64";
-static const char vs10IA64generatorName[] = "Visual Studio 10 IA64";
+static const char vs10generatorName[] = "Visual Studio 10 2010";
+
+// Map generator name without year to name with year.
+static const char* cmVS10GenName(const char* name, std::string& genName)
+{
+ if(strncmp(name, vs10generatorName, sizeof(vs10generatorName)-6) != 0)
+ {
+ return 0;
+ }
+ const char* p = name + sizeof(vs10generatorName) - 6;
+ if(strncmp(p, " 2010", 5) == 0)
+ {
+ p += 5;
+ }
+ genName = std::string(vs10generatorName) + p;
+ return p;
+}
class cmGlobalVisualStudio10Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
- if(!strcmp(name, vs10Win32generatorName))
+ virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+ {
+ std::string genName;
+ const char* p = cmVS10GenName(name, genName);
+ if(!p)
+ { return 0; }
+ name = genName.c_str();
+ if(strcmp(p, "") == 0)
{
return new cmGlobalVisualStudio10Generator(
name, NULL, NULL);
}
- if(!strcmp(name, vs10Win64generatorName))
+ if(strcmp(p, " Win64") == 0)
{
return new cmGlobalVisualStudio10Generator(
name, "x64", "CMAKE_FORCE_WIN64");
}
- if(!strcmp(name, vs10IA64generatorName))
+ if(strcmp(p, " IA64") == 0)
{
return new cmGlobalVisualStudio10Generator(
name, "Itanium", "CMAKE_FORCE_IA64");
}
return 0;
- }
+ }
- virtual void GetDocumentation(cmDocumentationEntry& entry) const {
- entry.Name = "Visual Studio 10";
- entry.Brief = "Generates Visual Studio 10 (2010) project files.";
- }
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ {
+ entry.Name = vs10generatorName;
+ entry.Brief = "Generates Visual Studio 10 (VS 2010) project files.";
+ }
- virtual void GetGenerators(std::vector<std::string>& names) const {
- names.push_back(vs10Win32generatorName);
- names.push_back(vs10Win64generatorName);
- names.push_back(vs10IA64generatorName); }
+ virtual void GetGenerators(std::vector<std::string>& names) const
+ {
+ names.push_back(vs10generatorName);
+ names.push_back(vs10generatorName + std::string(" IA64"));
+ names.push_back(vs10generatorName + std::string(" Win64"));
+ }
};
//----------------------------------------------------------------------------
@@ -79,6 +102,18 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
//----------------------------------------------------------------------------
bool
+cmGlobalVisualStudio10Generator::MatchesGeneratorName(const char* name) const
+{
+ std::string genName;
+ if(cmVS10GenName(name, genName))
+ {
+ return genName == this->GetName();
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
+bool
cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts)
{
this->PlatformToolset = ts;