summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-21 14:38:49 -0400
committerBrad King <brad.king@kitware.com>2016-09-22 13:52:03 -0400
commita57d1bb7122be79101cc17a4b8a04bd0ac5a041e (patch)
treed93b47452107019afc48878b86b5b4685df7838c
parent0488ae63ea8dfa8ac455e36b7cc41e81620a080f (diff)
downloadcmake-a57d1bb7122be79101cc17a4b8a04bd0ac5a041e.tar.gz
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.
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx11
-rw-r--r--Source/cmGlobalNinjaGenerator.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 77693fefda..42ce6227a6 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -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(
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 5c7d8fa591..0183952fed 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -444,6 +444,7 @@ private:
std::string NinjaVersion;
bool NinjaSupportsConsolePool;
bool NinjaSupportsImplicitOuts;
+ unsigned long NinjaSupportsDyndeps;
private:
void InitOutputPathPrefix();