cmGlobalGenerator: Create a non-virtual 'DoGenerate' method

Make the virtual 'Generate' method protected.  Make 'DoGenerate'
the main entry point to generation.  This gives cmGlobalGenerator
a chance to do some early operations before the individual
generator-specific implementations take over.
This commit is contained in:
Brad King 2014-07-22 15:01:05 -04:00
parent 5c38fc1628
commit f5c0efdbe4
10 changed files with 22 additions and 35 deletions

View File

@ -1153,7 +1153,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
return false;
}
void cmGlobalGenerator::Generate()
void cmGlobalGenerator::DoGenerate()
{
// Some generators track files replaced during the Generate.
// Start with an empty vector:
@ -1162,6 +1162,11 @@ void cmGlobalGenerator::Generate()
// clear targets to issue warning CMP0042 for
this->CMP0042WarnTargets.clear();
this->Generate();
}
void cmGlobalGenerator::Generate()
{
// Check whether this generator is allowed to run.
if(!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS())
{

View File

@ -80,7 +80,7 @@ public:
* basically creates a series of LocalGenerators for each directory and
* requests that they Generate.
*/
virtual void Generate();
void DoGenerate();
/**
* Set/Get and Clear the enabled languages.
@ -338,6 +338,8 @@ public:
bool GenerateCPackPropertiesFile();
protected:
virtual void Generate();
typedef std::vector<cmLocalGenerator*> GeneratorVector;
// for a project collect all its targets by following depend
// information, and also collect all the targets

View File

@ -182,9 +182,6 @@ public:
/// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
static void GetDocumentation(cmDocumentationEntry& entry);
/// Overloaded methods. @see cmGlobalGenerator::Generate()
virtual void Generate();
/// Overloaded methods. @see cmGlobalGenerator::EnableLanguage()
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile* mf,
@ -302,6 +299,9 @@ public:
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
protected:
/// Overloaded methods. @see cmGlobalGenerator::Generate()
virtual void Generate();
/// Overloaded methods.
/// @see cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; }

View File

@ -47,8 +47,6 @@ public:
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator();
virtual void Generate();
/**
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
@ -93,6 +91,8 @@ public:
virtual void FindMakeProgram(cmMakefile*);
protected:
virtual void Generate();
virtual const char* GetIDEVersion() { return "10.0"; }
std::string const& GetMSBuildCommand();

View File

@ -63,13 +63,6 @@ public:
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/**
* Generate the all required files for building this project/tree. This
* basically creates a series of LocalGenerators for each directory and
* requests that they Generate.
*/
virtual void Generate();
/**
* Generate the DSW workspace file.
*/
@ -94,6 +87,7 @@ public:
virtual bool IsForVS6() const { return true; }
protected:
virtual void Generate();
virtual const char* GetIDEVersion() { return "6.0"; }
private:
virtual std::string GetVSMakeProgram() { return this->GetMSDevCommand(); }

View File

@ -71,13 +71,6 @@ public:
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/**
* Generate the all required files for building this project/tree. This
* basically creates a series of LocalGenerators for each directory and
* requests that they Generate.
*/
virtual void Generate();
/**
* Generate the DSW workspace file.
*/
@ -113,6 +106,7 @@ public:
virtual std::string Encoding();
protected:
virtual void Generate();
virtual const char* GetIDEVersion() { return "7.0"; }
std::string const& GetDevEnvCommand();

View File

@ -45,7 +45,6 @@ public:
* target.
*/
virtual void Configure();
virtual void Generate();
/**
* Where does this version of Visual Studio look for macros for the
@ -69,6 +68,7 @@ public:
return !this->WindowsCEVersion.empty(); }
protected:
virtual void Generate();
virtual const char* GetIDEVersion() { return "8.0"; }
virtual std::string FindDevEnvCommand();

View File

@ -26,11 +26,6 @@ public:
cmGlobalVisualStudioGenerator();
virtual ~cmGlobalVisualStudioGenerator();
/**
* Basic generate implementation for all VS generators.
*/
virtual void Generate();
/**
* Configure CMake's Visual Studio macros file into the user's Visual
* Studio macros directory.
@ -90,6 +85,8 @@ public:
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
protected:
virtual void Generate();
// Does this VS version link targets to each other if there are
// dependencies in the SLN file? This was done for VS versions
// below 8.

View File

@ -64,13 +64,6 @@ public:
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/**
* Generate the all required files for building this project/tree. This
* basically creates a series of LocalGenerators for each directory and
* requests that they Generate.
*/
virtual void Generate();
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const std::string& prefix,
const std::string& config,
@ -91,6 +84,8 @@ public:
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
void AppendFlag(std::string& flags, std::string const& flag);
protected:
virtual void Generate();
private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
cmSourceGroup* sg);

View File

@ -1715,7 +1715,7 @@ int cmake::Generate()
{
return -1;
}
this->GlobalGenerator->Generate();
this->GlobalGenerator->DoGenerate();
if ( !this->GraphVizFile.empty() )
{
std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl;