summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-21 19:05:34 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-22 17:53:09 (GMT)
commit9a77680eed49939f8ba418af96eefd42ecea0ae1 (patch)
treecd0f4e9a8848803c91fc6b6269a5c226283ee2d5
parent0f331d7893bee523e61109661d4e51566f41c350 (diff)
downloadCMake-9a77680eed49939f8ba418af96eefd42ecea0ae1.zip
CMake-9a77680eed49939f8ba418af96eefd42ecea0ae1.tar.gz
CMake-9a77680eed49939f8ba418af96eefd42ecea0ae1.tar.bz2
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.
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx43
-rw-r--r--Source/cmGlobalNinjaGenerator.h1
2 files changed, 40 insertions, 4 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index c0503eb..81690e7 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -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)
{
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 6fb93e4..76430a0 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -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();