summaryrefslogtreecommitdiff
path: root/Source/cmGlobalVisualStudio14Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-11-14 14:21:50 -0500
committerBrad King <brad.king@kitware.com>2014-11-14 14:23:36 -0500
commitf5afb90d7c0ff756dedc3d473c0fb60dee004d82 (patch)
tree4a2e66ea1664604ad85b63e52e7f1a3671eb561b /Source/cmGlobalVisualStudio14Generator.cxx
parent433c6d4689ca86f1a8d8d966be0204e98f95b968 (diff)
downloadcmake-f5afb90d7c0ff756dedc3d473c0fb60dee004d82.tar.gz
VS: Rename VS 14 generator to 'Visual Studio 14 2015'
Now that we know the year component of this VS version we can add it to the generator name. For convenience, map the name without the year to the name with the year.
Diffstat (limited to 'Source/cmGlobalVisualStudio14Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx40
1 files changed, 30 insertions, 10 deletions
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index d001f93167..fe702c06cf 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -13,21 +13,36 @@
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
-static const char vs14generatorName[] = "Visual Studio 14";
+static const char vs14generatorName[] = "Visual Studio 14 2015";
+
+// Map generator name without year to name with year.
+static const char* cmVS14GenName(const std::string& name, std::string& genName)
+{
+ if(strncmp(name.c_str(), vs14generatorName,
+ sizeof(vs14generatorName)-6) != 0)
+ {
+ return 0;
+ }
+ const char* p = name.c_str() + sizeof(vs14generatorName) - 6;
+ if(cmHasLiteralPrefix(p, " 2015"))
+ {
+ p += 5;
+ }
+ genName = std::string(vs14generatorName) + p;
+ return p;
+}
class cmGlobalVisualStudio14Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
virtual cmGlobalGenerator* CreateGlobalGenerator(
- const std::string& genName) const
+ const std::string& name) const
{
- if(strncmp(genName.c_str(), vs14generatorName,
- sizeof(vs14generatorName) - 1) != 0)
- {
- return 0;
- }
- const char* p = genName.c_str() + sizeof(vs14generatorName) - 1;
+ std::string genName;
+ const char* p = cmVS14GenName(name, genName);
+ if(!p)
+ { return 0; }
if(!*p)
{
return new cmGlobalVisualStudio14Generator(
@@ -51,7 +66,7 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const
{
entry.Name = vs14generatorName;
- entry.Brief = "Generates Visual Studio 14 project files.";
+ entry.Brief = "Generates Visual Studio 14 (VS 2015) project files.";
}
virtual void GetGenerators(std::vector<std::string>& names) const
@@ -85,7 +100,12 @@ bool
cmGlobalVisualStudio14Generator::MatchesGeneratorName(
const std::string& name) const
{
- return name == this->GetName();
+ std::string genName;
+ if(cmVS14GenName(name, genName))
+ {
+ return genName == this->GetName();
+ }
+ return false;
}
//----------------------------------------------------------------------------