Ninja: Conditionally allow Fortran based on ninja 'dyndep' support

Detect from the version of Ninja whether it supports the dynamically
discovered dependencies (dyndep) feature needed to support Fortran.
This commit is contained in:
Brad King 2016-09-21 15:05:34 -04:00
parent 0f331d7893
commit 9a77680eed
2 changed files with 40 additions and 4 deletions

View File

@ -595,14 +595,49 @@ bool cmGlobalNinjaGenerator::CheckLanguages(
{
if (std::find(languages.begin(), languages.end(), "Fortran") !=
languages.end()) {
mf->IssueMessage(cmake::FATAL_ERROR,
"The Ninja generator does not support Fortran yet.");
cmSystemTools::SetFatalErrorOccured();
return false;
return this->CheckFortran(mf);
}
return true;
}
bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const
{
if (this->NinjaSupportsDyndeps == 1) {
return true;
}
std::ostringstream e;
if (this->NinjaSupportsDyndeps == 0) {
/* clang-format off */
e <<
"The Ninja generator does not support Fortran using Ninja version\n"
" " + this->NinjaVersion + "\n"
"due to lack of required features. "
"Kitware has implemented the required features but as of this version "
"of CMake they have not been integrated to upstream ninja. "
"Pending integration, Kitware maintains a branch at:\n"
" https://github.com/Kitware/ninja/tree/features-for-fortran#readme\n"
"with the required features. "
"One may build ninja from that branch to get support for Fortran."
;
/* clang-format on */
} else {
/* clang-format off */
e <<
"The Ninja generator in this version of CMake does not support Fortran "
"using Ninja version\n"
" " + this->NinjaVersion + "\n"
"because its 'dyndep' feature version is " <<
this->NinjaSupportsDyndeps << ". "
"This version of CMake is aware only of 'dyndep' feature version 1."
;
/* clang-format on */
}
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccured();
return false;
}
void cmGlobalNinjaGenerator::EnableLanguage(
std::vector<std::string> const& langs, cmMakefile* mf, bool optional)
{

View File

@ -367,6 +367,7 @@ private:
void CheckNinjaFeatures();
bool CheckLanguages(std::vector<std::string> const& languages,
cmMakefile* mf) const CM_OVERRIDE;
bool CheckFortran(cmMakefile* mf) const;
void OpenBuildFileStream();
void CloseBuildFileStream();