Bazel to cmake: Sort target lists

There's been some previous discussion about sorting cmake dependencies vs preserving the order from bazel (https://github.com/google/iree/issues/538).

I think we've come to a point where we're going to have to switch to alphabetical order. I've just about got bazel_to_cmake working upstream, where the order of dependencies is different, so there's no way we can have it preserve order and have that.

The good news is that this means it should be possible to enforce that people run the tool as a presubmit, which should keep those files up to date much better.

Closes https://github.com/google/iree/pull/777

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/iree/pull/777 from GMNGeoffrey:bazel-to-cmake-sorting 80caba353983abf30440d6f6c602d417f52dd5f2
PiperOrigin-RevId: 295780072
diff --git a/build_tools/bazel_to_cmake/bazel_to_cmake.py b/build_tools/bazel_to_cmake/bazel_to_cmake.py
index 55d5ff9..6977ad8 100755
--- a/build_tools/bazel_to_cmake/bazel_to_cmake.py
+++ b/build_tools/bazel_to_cmake/bazel_to_cmake.py
@@ -31,7 +31,6 @@
 import datetime
 import os
 import textwrap
-from collections import OrderedDict
 from itertools import repeat, chain
 import glob
 import re
@@ -234,8 +233,12 @@
     targets = [self._convert_target(t) for t in targets]
     # Flatten lists
     targets = list(chain.from_iterable(targets))
-    # Remove Falsey (None and empty string) values and duplicates, preserving the original ordering.
-    targets = list(filter(None, OrderedDict(zip(targets, repeat(None)))))
+    # Remove duplicates
+    targets = set(targets)
+    # Remove Falsey (None and empty string) values
+    targets = filter(None, targets)
+    # Sort the targets and convert to a list
+    targets = sorted(targets)
     target_list_string = "\n".join(["    %s" % (t,) for t in targets])
     return "  %s\n%s\n" % (
         list_name,