cmGlobalNinjaGenerator: Add API to check for implicit outputs support

Ninja 1.7 introduced support for implicit outputs on build statements.
Add an internal API to check whether the Ninja version in use for the
build supports this feature.
This commit is contained in:
Brad King 2016-09-19 16:27:21 -04:00
parent 144a24dcdc
commit 501f9c9367
2 changed files with 9 additions and 0 deletions

View File

@ -1306,6 +1306,13 @@ bool cmGlobalNinjaGenerator::SupportsConsolePool() const
RequiredNinjaVersionForConsolePool().c_str()); RequiredNinjaVersionForConsolePool().c_str());
} }
bool cmGlobalNinjaGenerator::SupportsImplicitOuts() const
{
return !cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
this->RequiredNinjaVersionForImplicitOuts().c_str());
}
void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
{ {
WriteRule(*this->RulesFileStream, "CLEAN", ninjaCmd() + " -t clean", WriteRule(*this->RulesFileStream, "CLEAN", ninjaCmd() + " -t clean",

View File

@ -339,7 +339,9 @@ public:
// Ninja generator uses 'deps' and 'msvc_deps_prefix' introduced in 1.3 // Ninja generator uses 'deps' and 'msvc_deps_prefix' introduced in 1.3
static std::string RequiredNinjaVersion() { return "1.3"; } static std::string RequiredNinjaVersion() { return "1.3"; }
static std::string RequiredNinjaVersionForConsolePool() { return "1.5"; } static std::string RequiredNinjaVersionForConsolePool() { return "1.5"; }
static std::string RequiredNinjaVersionForImplicitOuts() { return "1.7"; }
bool SupportsConsolePool() const; bool SupportsConsolePool() const;
bool SupportsImplicitOuts() const;
std::string NinjaOutputPath(std::string const& path); std::string NinjaOutputPath(std::string const& path);
bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); } bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); }