[CMake] Why not a GetCleanTargetName?
Miguel A. Figueroa-Villanueva
miguelf at ieee.org
Fri Aug 3 20:00:58 EDT 2007
Hello,
Why isn't there the following in cmGlobalGenerator.h :
virtual const char* GetCleanTargetName() { return 0; }
and the following in cmGlobalUnixMakefileGenerator3.h :
virtual const char* GetCleanTargetName() { return "clean"; }
The reason I ask is because I needed for the Eclipse generator code.
If there is a better way to do what I describe below, please let me
know?
I find that in the cmGlobalGenerator.h there are the following
declarations, which are overriden by cmLocalUnixMakefileGenerator3.h
which supports them all:
virtual const char* GetAllTargetName() { return "ALL_BUILD"; }
virtual const char* GetInstallTargetName() { return "INSTALL"; }
virtual const char* GetInstallLocalTargetName() { return 0; }
virtual const char* GetInstallStripTargetName() { return 0; }
virtual const char* GetPreinstallTargetName() { return 0; }
virtual const char* GetTestTargetName() { return "RUN_TESTS"; }
virtual const char* GetPackageTargetName() { return "PACKAGE"; }
virtual const char* GetPackageSourceTargetName(){ return 0; }
virtual const char* GetEditCacheTargetName() { return 0; }
virtual const char* GetRebuildCacheTargetName() { return 0; }
I use these to determine if the targets 'all', 'clean', and
'preinstall' are available for the generator. Note that these three
targets are not added to the cmTargets map, so I don't get them in the
list below. Is there a reason not to add these to the map?
for (std::vector<cmLocalGenerator*>::const_iterator
it = this->GlobalGenerator->GetLocalGenerators().begin();
it != this->GlobalGenerator->GetLocalGenerators().end();
++it)
{
const cmTargets& targets = (*it)->GetMakefile()->GetTargets();
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
{
if(emmited.find(t->first) == emmited.end())
{
emmited.insert(t->first);
this->AppendTarget(fout, t->first);
}
}
}
--Miguel
More information about the CMake
mailing list