summaryrefslogtreecommitdiff
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-20 15:55:34 -0400
committerBen Boeckel <ben.boeckel@kitware.com>2017-04-21 08:57:02 -0400
commitb57b7d8e55f5380a70c98dd5feeb01c40325f403 (patch)
tree1843bdeae9232fff02d7d6148d17111b202e4cbd /Source/cmNinjaTargetGenerator.cxx
parent0ad8e4ea658ed992841c81dca2c5eb31abc40983 (diff)
downloadcmake-b57b7d8e55f5380a70c98dd5feeb01c40325f403.tar.gz
Ninja: Order Fortran dyndep file generation explicitly
Each target's dyndep file generation depends on loading information generated by the same step in its dependencies. Add an explicit ordering dependency to ensure the needed information is available. Without the explicit ordering dependency we were abusing the more general target ordering rules through the preprocessor rules generating the `.ddi` files used as input to dyndep file generation.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b00815864d..a34ff3fa00 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -767,6 +767,17 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
ddOutputs.push_back(this->GetDyndepFilePath("Fortran"));
+ // Make sure dyndep files for all our dependencies have already
+ // been generated so that the 'FortranModules.json' files they
+ // produced as side-effects are available for us to read.
+ // Ideally we should depend on the 'FortranModules.json' files
+ // from our dependencies directly, but we don't know which of
+ // our dependencies produces them. Fixing this will require
+ // refactoring the Ninja generator to generate targets in
+ // dependency order so that we can collect the needed information.
+ this->GetLocalGenerator()->AppendTargetDepends(this->GeneratorTarget,
+ ddOrderOnlyDeps);
+
this->GetGlobalGenerator()->WriteBuild(
this->GetBuildFileStream(), ddComment, ddRule, ddOutputs, ddImplicitOuts,
ddExplicitDeps, ddImplicitDeps, ddOrderOnlyDeps, ddVars);