diff options
author | Brad King <brad.king@kitware.com> | 2016-02-11 15:41:18 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-02-11 15:41:18 (GMT) |
commit | 53108f800841f3889ef9dc644a12b803a017ce34 (patch) | |
tree | 5cd22d2f16bad4953efb3ced6e36b18d6a0f3271 /Source | |
parent | 08ccb837c3b5b5eed38adbb96e2f1811af7bfe5f (diff) | |
parent | 59ade844ef01f0c8a4db3a5593f79210edcf6cbc (diff) | |
download | CMake-53108f800841f3889ef9dc644a12b803a017ce34.zip CMake-53108f800841f3889ef9dc644a12b803a017ce34.tar.gz CMake-53108f800841f3889ef9dc644a12b803a017ce34.tar.bz2 |
Merge topic 'ninja-deterministic-gen'
59ade844 Ninja: Fix non-determinism in generated build statement order (#15968)
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 17 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.h | 1 |
2 files changed, 15 insertions, 3 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index b2927a9..8a68af6 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -454,13 +454,24 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc, cmGeneratorTarget* target) { - this->CustomCommandTargets[cc].insert(target); + CustomCommandTargetMap::value_type v(cc, std::set<cmGeneratorTarget*>()); + std::pair<CustomCommandTargetMap::iterator, bool> + ins = this->CustomCommandTargets.insert(v); + if (ins.second) + { + this->CustomCommands.push_back(cc); + } + ins.first->second.insert(target); } void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements() { - for (CustomCommandTargetMap::iterator i = this->CustomCommandTargets.begin(); - i != this->CustomCommandTargets.end(); ++i) { + for (std::vector<cmCustomCommand const*>::iterator vi = + this->CustomCommands.begin(); vi != this->CustomCommands.end(); ++vi) + { + CustomCommandTargetMap::iterator i = this->CustomCommandTargets.find(*vi); + assert(i != this->CustomCommandTargets.end()); + // A custom command may appear on multiple targets. However, some build // systems exist where the target dependencies on some of the targets are // overspecified, leading to a dependency cycle. If we assume all target diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index b6987ef..5e1d6f2 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -106,6 +106,7 @@ private: typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*> > CustomCommandTargetMap; CustomCommandTargetMap CustomCommandTargets; + std::vector<cmCustomCommand const*> CustomCommands; }; #endif // ! cmLocalNinjaGenerator_h |