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:
parent
0f331d7893
commit
9a77680eed
|
@ -595,14 +595,49 @@ bool cmGlobalNinjaGenerator::CheckLanguages(
|
||||||
{
|
{
|
||||||
if (std::find(languages.begin(), languages.end(), "Fortran") !=
|
if (std::find(languages.begin(), languages.end(), "Fortran") !=
|
||||||
languages.end()) {
|
languages.end()) {
|
||||||
mf->IssueMessage(cmake::FATAL_ERROR,
|
return this->CheckFortran(mf);
|
||||||
"The Ninja generator does not support Fortran yet.");
|
|
||||||
cmSystemTools::SetFatalErrorOccured();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
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(
|
void cmGlobalNinjaGenerator::EnableLanguage(
|
||||||
std::vector<std::string> const& langs, cmMakefile* mf, bool optional)
|
std::vector<std::string> const& langs, cmMakefile* mf, bool optional)
|
||||||
{
|
{
|
||||||
|
|
|
@ -367,6 +367,7 @@ private:
|
||||||
void CheckNinjaFeatures();
|
void CheckNinjaFeatures();
|
||||||
bool CheckLanguages(std::vector<std::string> const& languages,
|
bool CheckLanguages(std::vector<std::string> const& languages,
|
||||||
cmMakefile* mf) const CM_OVERRIDE;
|
cmMakefile* mf) const CM_OVERRIDE;
|
||||||
|
bool CheckFortran(cmMakefile* mf) const;
|
||||||
|
|
||||||
void OpenBuildFileStream();
|
void OpenBuildFileStream();
|
||||||
void CloseBuildFileStream();
|
void CloseBuildFileStream();
|
||||||
|
|
Loading…
Reference in New Issue