diff options
author | Brad King <brad.king@kitware.com> | 2016-02-12 13:45:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-02-12 13:51:58 (GMT) |
commit | 46fa9583624b3dd2b2dad978cb0313b78eae5f53 (patch) | |
tree | d70360b14336ea1c4755bb404f0803fe36b89b2f /Source/cmGlobalNinjaGenerator.cxx | |
parent | 59ade844ef01f0c8a4db3a5593f79210edcf6cbc (diff) | |
download | CMake-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/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 5 |
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()); } } |