From 92cee7626c5066a4af4cf66f85b0cd2c06bd9439 Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Thu, 19 Apr 2012 17:07:35 +0200 Subject: [PATCH] Ninja: Add a convenient 'help' target. --- Source/cmGlobalNinjaGenerator.cxx | 21 +++++++++++++++++++++ Source/cmGlobalNinjaGenerator.h | 1 + 2 files changed, 22 insertions(+) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index ee3842d0b5..67f809a9db 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -755,6 +755,7 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os) this->WriteTargetAll(os); this->WriteTargetRebuildManifest(os); this->WriteTargetClean(os); + this->WriteTargetHelp(os); } void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os) @@ -841,3 +842,23 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) /*orderOnlyDeps=*/ cmNinjaDeps(), /*variables=*/ cmNinjaVars()); } + +void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) +{ + WriteRule(*this->RulesFileStream, + "HELP", + "ninja -t targets", + "All primary targets available:", + "Rule for printing all primary targets available.", + /*depfile=*/ "", + /*restat=*/ false, + /*generator=*/ false); + WriteBuild(os, + "Print all primary targets available.", + "HELP", + /*outputs=*/ cmNinjaDeps(1, "help"), + /*explicitDeps=*/ cmNinjaDeps(), + /*implicitDeps=*/ cmNinjaDeps(), + /*orderOnlyDeps=*/ cmNinjaDeps(), + /*variables=*/ cmNinjaVars()); +} diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 32edfaabc2..e652972eeb 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -274,6 +274,7 @@ private: void WriteTargetAll(std::ostream& os); void WriteTargetRebuildManifest(std::ostream& os); void WriteTargetClean(std::ostream& os); + void WriteTargetHelp(std::ostream& os); /// Called when we have seen the given custom command. Returns true /// if we has seen it before.