Avoid duplicate ZERO_CHECK in VS solutions

The commit "Avoid non-root copies of root-only targets" moved the check
for root-only targets into cmGlobalGenerator::GetTargetSets to avoid
adding multiple ALL_BUILD targets to the "original" target set.  This
approach did not work for ZERO_CHECK targets though because those are
pulled in by dependency analysis.

Instead we eliminate duplicate ZERO_CHECK targets altogether and refer
to a single one from all solution files.  This cleans up VS 10 project
file references to ZERO_CHECK targets anyway.
This commit is contained in:
Brad King 2009-10-19 10:47:34 -04:00
parent 180a681b53
commit 7766473d3e
4 changed files with 112 additions and 127 deletions

View File

@ -615,13 +615,6 @@ cmGlobalVisualStudio7Generator
} }
} }
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio7Generator::IsRootOnlyTarget(cmTarget* target)
{
return (this->cmGlobalVisualStudioGenerator::IsRootOnlyTarget(target) ||
strcmp(target->GetName(), CMAKE_CHECK_BUILD_SYSTEM_TARGET) == 0);
}
bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
cmTarget* target) cmTarget* target)
{ {

View File

@ -133,7 +133,6 @@ protected:
std::string ConvertToSolutionPath(const char* path); std::string ConvertToSolutionPath(const char* path);
virtual bool IsRootOnlyTarget(cmTarget* target);
bool IsPartOfDefaultBuild(const char* project, bool IsPartOfDefaultBuild(const char* project,
cmTarget* target); cmTarget* target);
std::vector<std::string> Configurations; std::vector<std::string> Configurations;

View File

@ -110,20 +110,13 @@ std::string cmGlobalVisualStudio8Generator::GetUserMacrosRegKeyBase()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::Generate() void cmGlobalVisualStudio8Generator::AddCheckTarget()
{ {
// Add a special target on which all other targets depend that // Add a special target on which all other targets depend that
// checks the build system and optionally re-runs CMake. // checks the build system and optionally re-runs CMake.
const char* no_working_directory = 0; const char* no_working_directory = 0;
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; std::vector<cmLocalGenerator*> const& generators = this->LocalGenerators;
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
{
std::vector<cmLocalGenerator*>& generators = it->second;
if(!generators.empty())
{
// Add the build-system check target to the first local
// generator of this project.
cmLocalVisualStudio7Generator* lg = cmLocalVisualStudio7Generator* lg =
static_cast<cmLocalVisualStudio7Generator*>(generators[0]); static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
cmMakefile* mf = lg->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
@ -131,21 +124,15 @@ void cmGlobalVisualStudio8Generator::Generate()
// Skip the target if no regeneration is to be done. // Skip the target if no regeneration is to be done.
if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
{ {
continue; return;
} }
std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLines noCommandLines; cmCustomCommandLines noCommandLines;
cmTarget* tgt =
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
no_working_directory, no_depends, no_working_directory, no_depends,
noCommandLines); noCommandLines);
cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
if(!tgt)
{
cmSystemTools::Error("Error adding target "
CMAKE_CHECK_BUILD_SYSTEM_TARGET);
continue;
}
// Create a list of all stamp files for this project. // Create a list of all stamp files for this project.
std::vector<std::string> stamps; std::vector<std::string> stamps;
@ -234,8 +221,12 @@ void cmGlobalVisualStudio8Generator::Generate()
cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
} }
} }
} }
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::Generate()
{
this->AddCheckTarget();
// All targets depend on the build-system check target. // All targets depend on the build-system check target.
for(std::map<cmStdString,cmTarget *>::const_iterator for(std::map<cmStdString,cmTarget *>::const_iterator

View File

@ -63,6 +63,8 @@ protected:
virtual bool VSLinksDependencies() const { return false; } virtual bool VSLinksDependencies() const { return false; }
void AddCheckTarget();
static cmIDEFlagTable const* GetExtraFlagTableVS8(); static cmIDEFlagTable const* GetExtraFlagTableVS8();
virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout);