Simplify VS generator ZERO_CHECK dependency

The VS generators use a ZERO_CHECK target on which all other targets
depend to check whether CMake needs to re-run.  This commit simplifies
the addition of a dependency on the target to all other targets.

We also move addition of dependencies to the beginning of the Generate
step.  This allows the dependency on ZERO_CHECK to be included in the
global inter-target dependency analysis.
This commit is contained in:
Brad King 2009-09-04 12:37:53 -04:00
parent 7f9a0f508f
commit 524bb1e36e
2 changed files with 8 additions and 37 deletions

View File

@ -242,46 +242,19 @@ void cmGlobalVisualStudio8Generator::Generate()
}
}
// Now perform the main generation.
this->cmGlobalVisualStudio7Generator::Generate();
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::WriteSLNFile(
std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
// Make all targets depend on their respective project's build
// system check target.
unsigned int i;
for(i = 0; i < generators.size(); ++i)
// All targets depend on the build-system check target.
for(std::map<cmStdString,cmTarget *>::const_iterator
ti = this->TotalTargets.begin();
ti != this->TotalTargets.end(); ++ti)
{
if(this->IsExcluded(root, generators[i]))
if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
{
continue;
}
cmMakefile* mf = generators[i]->GetMakefile();
cmTargets& tgts = mf->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET)
{
for(unsigned int j = 0; j < generators.size(); ++j)
{
// Every target in all generators should depend on this target.
cmMakefile* lmf = generators[j]->GetMakefile();
cmTargets &atgts = lmf->GetTargets();
for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al)
{
al->second.AddUtility(l->first.c_str());
}
}
}
ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
}
}
// Now write the solution file.
this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators);
// Now perform the main generation.
this->cmGlobalVisualStudio7Generator::Generate();
}
//----------------------------------------------------------------------------

View File

@ -69,8 +69,6 @@ protected:
static cmIDEFlagTable const* GetExtraFlagTableVS8();
virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(std::ostream& fout,