Commit 40a73280 authored by Brad King's avatar Brad King

VS: Clarify global generator constructor interface

Make the constructors protected since they should be produced through
factories.  Also rename `platform{ => InGenerator}Name` to clarify
the meaning of the argument.
parent 5ca7e505
......@@ -90,8 +90,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
}
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
cmake* cm, const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio8Generator(cm, name, platformName)
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName)
{
std::string vc10Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
......
......@@ -14,8 +14,6 @@
class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator
{
public:
cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
......@@ -125,6 +123,9 @@ public:
cmIDEFlagTable const* GetNasmFlagTable() const;
protected:
cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
void Generate() override;
virtual bool InitializeSystem(cmMakefile* mf);
virtual bool InitializeWindows(cmMakefile* mf);
......@@ -168,6 +169,8 @@ protected:
private:
class Factory;
friend class Factory;
struct LongestSourcePath
{
LongestSourcePath()
......
......@@ -92,8 +92,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
}
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
cmake* cm, const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio10Generator(cm, name, platformName)
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName)
{
std::string vc11Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
......
......@@ -20,13 +20,14 @@ class cmake;
class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator
{
public:
cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name,
const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
protected:
cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
bool InitializeWindowsPhone(cmMakefile* mf) override;
bool InitializeWindowsStore(cmMakefile* mf) override;
bool SelectWindowsPhoneToolset(std::string& toolset) const override;
......
......@@ -75,8 +75,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
}
cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
cmake* cm, const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio11Generator(cm, name, platformName)
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio11Generator(cm, name, platformInGeneratorName)
{
std::string vc12Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
......
......@@ -18,13 +18,14 @@ class cmake;
class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator
{
public:
cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name,
const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
protected:
cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
bool ProcessGeneratorToolsetField(std::string const& key,
std::string const& value) override;
......@@ -44,5 +45,6 @@ protected:
private:
class Factory;
friend class Factory;
};
#endif
......@@ -75,8 +75,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory()
}
cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
cmake* cm, const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio12Generator(cm, name, platformName)
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio12Generator(cm, name, platformInGeneratorName)
{
std::string vc14Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
......
......@@ -18,13 +18,14 @@ class cmake;
class cmGlobalVisualStudio14Generator : public cmGlobalVisualStudio12Generator
{
public:
cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name,
const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
protected:
cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
bool InitializeWindows(cmMakefile* mf) override;
bool InitializeWindowsStore(cmMakefile* mf) override;
bool SelectWindowsStoreToolset(std::string& toolset) const override;
......@@ -47,5 +48,6 @@ protected:
private:
class Factory;
friend class Factory;
};
#endif
......@@ -76,8 +76,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory()
}
cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator(
cmake* cm, const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio14Generator(cm, name, platformName)
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName)
{
this->ExpressEdition = false;
this->DefaultPlatformToolset = "v141";
......
......@@ -18,8 +18,6 @@ class cmake;
class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator
{
public:
cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name,
const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory();
bool MatchesGeneratorName(const std::string& name) const override;
......@@ -32,6 +30,9 @@ public:
std::string GetAuxiliaryToolset() const override;
protected:
cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
bool InitializeWindows(cmMakefile* mf) override;
bool SelectWindowsStoreToolset(std::string& toolset) const override;
......@@ -53,6 +54,7 @@ protected:
private:
class Factory;
friend class Factory;
mutable cmVSSetupAPIHelper vsSetupAPIHelper;
};
#endif
......@@ -41,7 +41,7 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] = {
};
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
cmake* cm, const std::string& platformName)
cmake* cm, std::string const& platformInGeneratorName)
: cmGlobalVisualStudioGenerator(cm)
{
this->IntelProjectVersion = 0;
......@@ -49,10 +49,10 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
this->MasmEnabled = false;
this->NasmEnabled = false;
if (platformName.empty()) {
if (platformInGeneratorName.empty()) {
this->DefaultPlatformName = "Win32";
} else {
this->DefaultPlatformName = platformName;
this->DefaultPlatformName = platformInGeneratorName;
}
this->ExtraFlagTable = cmVS7ExtraFlagTable;
}
......
......@@ -18,8 +18,6 @@ struct cmIDEFlagTable;
class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
{
public:
cmGlobalVisualStudio7Generator(cmake* cm,
const std::string& platformName = "");
~cmGlobalVisualStudio7Generator();
///! Get the name for the platform.
......@@ -110,6 +108,9 @@ public:
cmIDEFlagTable const* ExtraFlagTable;
protected:
cmGlobalVisualStudio7Generator(cmake* cm,
std::string const& platformInGeneratorName);
void Generate() override;
std::string const& GetDevEnvCommand();
......
......@@ -12,8 +12,9 @@
#include "cmake.h"
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
cmake* cm, const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio71Generator(cm, platformName)
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio71Generator(cm, platformInGeneratorName)
{
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->Name = name;
......
......@@ -13,9 +13,6 @@
class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
{
public:
cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name,
const std::string& platformName);
///! Get the name for the generator.
std::string GetName() const override { return this->Name; }
......@@ -45,6 +42,9 @@ public:
}
protected:
cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
void AddExtraIDETargets() override;
std::string FindDevEnvCommand() override;
......
......@@ -83,8 +83,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
}
cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(
cmake* cm, const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio8Generator(cm, name, platformName)
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName)
{
this->Version = VS9;
std::string vc9Express;
......
......@@ -13,8 +13,6 @@
class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator
{
public:
cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name,
const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory();
/**
......@@ -30,6 +28,10 @@ public:
*/
std::string GetUserMacrosRegKeyBase() override;
protected:
cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
private:
class Factory;
friend class Factory;
......
......@@ -41,7 +41,6 @@ public:
VS15 = 150
};
cmGlobalVisualStudioGenerator(cmake* cm);
virtual ~cmGlobalVisualStudioGenerator();
VSVersion GetVersion() const;
......@@ -133,6 +132,8 @@ public:
bool dryRun) override;
protected:
cmGlobalVisualStudioGenerator(cmake* cm);
void AddExtraIDETargets() override;
// Does this VS version link targets to each other if there are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment