The order of targets in the same scope is unstable, due to unordered_map
When one CMakeLists.txt has several targets, add/delete-ing target affects emission of generator, even if a simple add_custom_target(foo)
is added.
This can be easily observable with Ninja generator. I guess other generators would be affected.
This prevents CI. I am tracking difference of emitted build tree(s) between builds. I think, in general, it's not good thing to expose unordered_map
to generated files.
I could fix this, but I am afraid which would be suitable to CMake project.
With s/std::unordered_map
/std::map
/ to using cmTargetMap = std::unordered_map<std::string, cmTarget>;
in cmMakefile.h
, emission will become stable.
But this just stabilizes and would not be the right fix. I think it'd be best to emit targets with defined-order.
class cmMakefile
also has OrderedTargets
but it is unavailable due to lack of a few targets, for example, rebuild_cache
At first, let me show the right direction.