Ninja: Add API to check for dyndep support

Kitware maintains a branch of Ninja with support for dynamically
discovered dependencies (dyndep) that has not yet been accepted
upstream.  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-21 14:38:49 -04:00
parent 0488ae63ea
commit a57d1bb712
2 changed files with 12 additions and 0 deletions

View File

@ -475,6 +475,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
, PolicyCMP0058(cmPolicies::WARN)
, NinjaSupportsConsolePool(false)
, NinjaSupportsImplicitOuts(false)
, NinjaSupportsDyndeps(0)
{
#ifdef _WIN32
cm->GetState()->SetWindowsShell(true);
@ -572,6 +573,16 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
this->NinjaSupportsImplicitOuts = !cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
this->RequiredNinjaVersionForImplicitOuts().c_str());
{
// Our ninja branch adds ".dyndep-#" to its version number,
// where '#' is a feature-specific version number. Extract it.
static std::string const k_DYNDEP_ = ".dyndep-";
std::string::size_type pos = this->NinjaVersion.find(k_DYNDEP_);
if (pos != std::string::npos) {
const char* fv = this->NinjaVersion.c_str() + pos + k_DYNDEP_.size();
cmSystemTools::StringToULong(fv, &this->NinjaSupportsDyndeps);
}
}
}
bool cmGlobalNinjaGenerator::CheckLanguages(

View File

@ -444,6 +444,7 @@ private:
std::string NinjaVersion;
bool NinjaSupportsConsolePool;
bool NinjaSupportsImplicitOuts;
unsigned long NinjaSupportsDyndeps;
private:
void InitOutputPathPrefix();