Ninja: Add a convenient 'clean' target.

It has been asked on the mailing list:
http://public.kitware.com/pipermail/cmake-developers/2012-April/003805.html
This commit is contained in:
Nicolas Despres 2012-04-19 16:47:48 +02:00 committed by Peter Kuemmel
parent ad5c9d06c4
commit 3bd41f2eb5
2 changed files with 22 additions and 0 deletions

View File

@ -754,6 +754,7 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
this->WriteTargetAll(os);
this->WriteTargetRebuildManifest(os);
this->WriteTargetClean(os);
}
void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
@ -820,3 +821,23 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
implicitDeps,
cmNinjaDeps());
}
void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
{
WriteRule(*this->RulesFileStream,
"CLEAN",
"ninja -t clean",
"Cleaning all built files...",
"Rule for cleaning all built files.",
/*depfile=*/ "",
/*restat=*/ false,
/*generator=*/ false);
WriteBuild(os,
"Clean all the built files.",
"CLEAN",
/*outputs=*/ cmNinjaDeps(1, "clean"),
/*explicitDeps=*/ cmNinjaDeps(),
/*implicitDeps=*/ cmNinjaDeps(),
/*orderOnlyDeps=*/ cmNinjaDeps(),
/*variables=*/ cmNinjaVars());
}

View File

@ -273,6 +273,7 @@ private:
void WriteBuiltinTargets(std::ostream& os);
void WriteTargetAll(std::ostream& os);
void WriteTargetRebuildManifest(std::ostream& os);
void WriteTargetClean(std::ostream& os);
/// Called when we have seen the given custom command. Returns true
/// if we has seen it before.