cmGlobalGenerator: Virtualize the Compute step and override it.

This commit is contained in:
Stephen Kelly 2015-07-25 19:03:51 +02:00
parent ff1019bfac
commit 5edb335485
9 changed files with 42 additions and 13 deletions

View File

@ -86,7 +86,7 @@ public:
*/
virtual void Configure();
bool Compute();
virtual bool Compute();
enum TargetTypes {
AllTargets,

View File

@ -314,9 +314,18 @@ cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent,
}
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio10Generator::Compute()
{
if (!cmGlobalVisualStudio8Generator::Compute())
{
return false;
}
this->LongestSource = LongestSourcePath();
return true;
}
void cmGlobalVisualStudio10Generator::Generate()
{
this->LongestSource = LongestSourcePath();
this->cmGlobalVisualStudio8Generator::Generate();
if(this->LongestSource.Length > 0)
{

View File

@ -45,6 +45,8 @@ public:
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
virtual bool Compute();
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);

View File

@ -347,8 +347,13 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::Generate()
bool cmGlobalVisualStudio8Generator::Compute()
{
if (!cmGlobalVisualStudio7Generator::Compute())
{
return false;
}
if(this->AddCheckTarget())
{
// All targets depend on the build-system check target.
@ -362,9 +367,7 @@ void cmGlobalVisualStudio8Generator::Generate()
}
}
}
// Now perform the main generation.
this->cmGlobalVisualStudio7Generator::Generate();
return true;
}
//----------------------------------------------------------------------------

View File

@ -67,7 +67,7 @@ public:
return !this->WindowsCEVersion.empty(); }
protected:
virtual void Generate();
virtual bool Compute();
virtual const char* GetIDEVersion() { return "8.0"; }
virtual std::string FindDevEnvCommand();

View File

@ -64,8 +64,13 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase(
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::Generate()
bool cmGlobalVisualStudioGenerator::Compute()
{
if (!cmGlobalGenerator::Compute())
{
return false;
}
// Add a special target that depends on ALL projects for easy build
// of one configuration only.
const char* no_working_dir = 0;
@ -136,9 +141,7 @@ void cmGlobalVisualStudioGenerator::Generate()
static_cast<cmLocalVisualStudioGenerator*>(*lgi);
lg->AddCMakeListsRules();
}
// Run all the local generators.
this->cmGlobalGenerator::Generate();
return true;
}
//----------------------------------------------------------------------------

View File

@ -108,7 +108,7 @@ public:
cmGeneratorTarget*, std::vector<cmCustomCommand>& commands,
std::string const& configName);
protected:
virtual void Generate();
virtual bool Compute();
// Does this VS version link targets to each other if there are
// dependencies in the SLN file? This was done for VS versions

View File

@ -378,8 +378,13 @@ cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
}
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::Generate()
bool cmGlobalXCodeGenerator::Compute()
{
if (!cmGlobalGenerator::Compute())
{
return false;
}
std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
// make sure extra targets are added before calling
// the parent generate which will call trace depends
@ -390,11 +395,17 @@ void cmGlobalXCodeGenerator::Generate()
// add ALL_BUILD, INSTALL, etc
this->AddExtraTargets(root, it->second);
}
return true;
}
void cmGlobalXCodeGenerator::Generate()
{
this->cmGlobalGenerator::Generate();
if(cmSystemTools::GetErrorOccuredFlag())
{
return;
}
std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
{
cmLocalGenerator* root = it->second[0];

View File

@ -88,6 +88,7 @@ public:
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
void AppendFlag(std::string& flags, std::string const& flag);
protected:
virtual bool Compute();
virtual void Generate();
private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,