Merge topic 'vs-generator-names'
29071fe
VS: Add version year to generator names
This commit is contained in:
commit
c247f1e175
|
@ -0,0 +1,12 @@
|
|||
Visual Studio 10 2010
|
||||
---------------------
|
||||
|
||||
Generates Visual Studio 10 (VS 2010) project files.
|
||||
|
||||
It is possible to append a space followed by the platform name to
|
||||
create project files for a specific target platform. E.g.
|
||||
"Visual Studio 10 2010 Win64" will create project files for the
|
||||
x64 processor; "Visual Studio 10 2010 IA64" for Itanium.
|
||||
|
||||
For compatibility with CMake versions prior to 3.0, one may specify this
|
||||
generator using the name "Visual Studio 10" without the year component.
|
|
@ -1,9 +0,0 @@
|
|||
Visual Studio 10
|
||||
----------------
|
||||
|
||||
Generates Visual Studio 10 (2010) project files.
|
||||
|
||||
It is possible to append a space followed by the platform name to
|
||||
create project files for a specific target platform. E.g. "Visual
|
||||
Studio 10 Win64" will create project files for the x64 processor;
|
||||
"Visual Studio 10 IA64" for Itanium.
|
|
@ -0,0 +1,12 @@
|
|||
Visual Studio 11 2012
|
||||
---------------------
|
||||
|
||||
Generates Visual Studio 11 (VS 2012) project files.
|
||||
|
||||
It is possible to append a space followed by the platform name to
|
||||
create project files for a specific target platform. E.g.
|
||||
"Visual Studio 11 2012 Win64" will create project files for the
|
||||
x64 processor; "Visual Studio 11 2012 ARM" for ARM.
|
||||
|
||||
For compatibility with CMake versions prior to 3.0, one may specify this
|
||||
generator using the name "Visual Studio 11" without the year component.
|
|
@ -1,9 +0,0 @@
|
|||
Visual Studio 11
|
||||
----------------
|
||||
|
||||
Generates Visual Studio 11 (2012) project files.
|
||||
|
||||
It is possible to append a space followed by the platform name to
|
||||
create project files for a specific target platform. E.g. "Visual
|
||||
Studio 11 Win64" will create project files for the x64 processor;
|
||||
"Visual Studio 11 ARM" for ARM.
|
|
@ -0,0 +1,12 @@
|
|||
Visual Studio 12 2013
|
||||
---------------------
|
||||
|
||||
Generates Visual Studio 12 (VS 2013) project files.
|
||||
|
||||
It is possible to append a space followed by the platform name to
|
||||
create project files for a specific target platform. E.g.
|
||||
"Visual Studio 12 2013 Win64" will create project files for the
|
||||
x64 processor; "Visual Studio 12 2013 ARM" for ARM.
|
||||
|
||||
For compatibility with CMake versions prior to 3.0, one may specify this
|
||||
generator using the name "Visual Studio 12" without the year component.
|
|
@ -1,9 +0,0 @@
|
|||
Visual Studio 12
|
||||
----------------
|
||||
|
||||
Generates Visual Studio 12 (2013) project files.
|
||||
|
||||
It is possible to append a space followed by the platform name to
|
||||
create project files for a specific target platform. E.g. "Visual
|
||||
Studio 12 Win64" will create project files for the x64 processor;
|
||||
"Visual Studio 12 ARM" for ARM.
|
|
@ -32,9 +32,9 @@ All Generators
|
|||
/generator/Sublime Text 2 - NMake Makefiles
|
||||
/generator/Sublime Text 2 - Unix Makefiles
|
||||
/generator/Unix Makefiles
|
||||
/generator/Visual Studio 10
|
||||
/generator/Visual Studio 11
|
||||
/generator/Visual Studio 12
|
||||
/generator/Visual Studio 10 2010
|
||||
/generator/Visual Studio 11 2012
|
||||
/generator/Visual Studio 12 2013
|
||||
/generator/Visual Studio 6
|
||||
/generator/Visual Studio 7 .NET 2003
|
||||
/generator/Visual Studio 7
|
||||
|
|
|
@ -52,6 +52,10 @@ public:
|
|||
///! Get the name for this generator
|
||||
virtual const char *GetName() const { return "Generic"; };
|
||||
|
||||
/** Check whether the given name matches the current generator. */
|
||||
virtual bool MatchesGeneratorName(const char* name) const
|
||||
{ return strcmp(this->GetName(), name) == 0; }
|
||||
|
||||
/** Set the generator-specific toolset name. Returns true if toolset
|
||||
is supported and false otherwise. */
|
||||
virtual bool SetGeneratorToolset(std::string const& ts);
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -77,6 +100,18 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
|
|||
this->MasmEnabled = false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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)
|
||||
|
|
|
@ -28,6 +28,8 @@ public:
|
|||
const char* platformName, const char* additionalPlatformDefinition);
|
||||
static cmGlobalGeneratorFactory* NewFactory();
|
||||
|
||||
virtual bool MatchesGeneratorName(const char* name) const;
|
||||
|
||||
virtual bool SetGeneratorToolset(std::string const& ts);
|
||||
|
||||
virtual std::string
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -106,6 +120,18 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
|
|||
this->PlatformToolset = "v110";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
const char* platformName, const char* additionalPlatformDefinition);
|
||||
static cmGlobalGeneratorFactory* NewFactory();
|
||||
|
||||
virtual bool MatchesGeneratorName(const char* name) const;
|
||||
|
||||
virtual void WriteSLNHeader(std::ostream& fout);
|
||||
|
||||
///! create the correct local generator
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -72,6 +95,18 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
|
|||
this->PlatformToolset = "v120";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
const char* platformName, const char* additionalPlatformDefinition);
|
||||
static cmGlobalGeneratorFactory* NewFactory();
|
||||
|
||||
virtual bool MatchesGeneratorName(const char* name) const;
|
||||
|
||||
virtual void WriteSLNHeader(std::ostream& fout);
|
||||
|
||||
///! create the correct local generator
|
||||
|
|
|
@ -1468,9 +1468,9 @@ int cmake::ActualConfigure()
|
|||
{"7.1", "Visual Studio 7 .NET 2003"},
|
||||
{"8.0", "Visual Studio 8 2005"},
|
||||
{"9.0", "Visual Studio 9 2008"},
|
||||
{"10.0", "Visual Studio 10"},
|
||||
{"11.0", "Visual Studio 11"},
|
||||
{"12.0", "Visual Studio 12"},
|
||||
{"10.0", "Visual Studio 10 2010"},
|
||||
{"11.0", "Visual Studio 11 2012"},
|
||||
{"12.0", "Visual Studio 12 2013"},
|
||||
{0, 0}};
|
||||
for(int i=0; version[i].MSVersion != 0; i++)
|
||||
{
|
||||
|
@ -1509,7 +1509,7 @@ int cmake::ActualConfigure()
|
|||
const char* genName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
|
||||
if(genName)
|
||||
{
|
||||
if(strcmp(this->GlobalGenerator->GetName(), genName) != 0)
|
||||
if(!this->GlobalGenerator->MatchesGeneratorName(genName))
|
||||
{
|
||||
std::string message = "Error: generator : ";
|
||||
message += this->GlobalGenerator->GetName();
|
||||
|
|
Loading…
Reference in New Issue