summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-12 13:45:09 (GMT)
committerBrad King <brad.king@kitware.com>2016-02-12 13:51:58 (GMT)
commit46fa9583624b3dd2b2dad978cb0313b78eae5f53 (patch)
treed70360b14336ea1c4755bb404f0803fe36b89b2f /Source
parent59ade844ef01f0c8a4db3a5593f79210edcf6cbc (diff)
downloadCMake-46fa9583624b3dd2b2dad978cb0313b78eae5f53.zip
CMake-46fa9583624b3dd2b2dad978cb0313b78eae5f53.tar.gz
CMake-46fa9583624b3dd2b2dad978cb0313b78eae5f53.tar.bz2
Ninja: Fix non-determinism in generated target dependency order (#15968)
We represent target dependency sets as `set<cmTargetDepend>` which orders by a `cmGeneratorTarget const*` pointer value. Therefore the order of dependencies encountered in AppendTargetDepends is not predictable. Sort them by content to make the result deterministic.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 0f06e43..bb5f921 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -991,6 +991,7 @@ cmGlobalNinjaGenerator
std::set<std::string> const& utils = target->GetUtilities();
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
} else {
+ cmNinjaDeps outs;
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
i != targetDeps.end(); ++i)
@@ -999,8 +1000,10 @@ cmGlobalNinjaGenerator
{
continue;
}
- this->AppendTargetOutputs(*i, outputs);
+ this->AppendTargetOutputs(*i, outs);
}
+ std::sort(outs.begin(), outs.end());
+ outputs.insert(outputs.end(), outs.begin(), outs.end());
}
}