code: def find_win32_generator():
      
      # XXX this assumes we will find a generator that's the same, or
      # compatible with, the one which was used to compile LLVM... cmake
      # seems a bit lacking here.
      cmake_dir = os.path.join(here_dir, 'dummy')
      # LLVM 4.0+ needs VS 2015 minimum.
      generators = []
      if os.environ.get("CMAKE_GENERATOR"):
          generators.append(os.environ.get("CMAKE_GENERATOR"))
  
      # Drop generators that are too old
      vspat = re.compile(r'Visual Studio (\d+)')
      def drop_old_vs(g):
          m = vspat.match(g)
          if m is None:
              return True  # keep those we don't recognize
          ver = int(m.group(1))
          return ver >= 14
      generators = list(filter(drop_old_vs, generators))
  
      generators.append('Visual Studio 14 2015' + (' Win64' if is_64bit else ''))
      for generator in generators:
          build_dir = tempfile.mkdtemp()
          print("Trying generator %r" % (generator,))
          try:
              try_cmake(cmake_dir, build_dir, generator)
          except subprocess.CalledProcessError:
              continue
          else:
              # Success
              return generator
          finally:
              shutil.rmtree(build_dir)
      raise RuntimeError("No compatible cmake generator installed on this machine")
docs: Find a suitable cmake "generator" under Windows.