public static Collection getAvailableGenerators()

in cmake-runner-agent/src/jetbrains/buildServer/cmakerunner/agent/util/CMakeUtil.java [42:70]


  public static Collection<String> getAvailableGenerators() {
    final String[] cmdline = {"cmake", "--help"};
    final Collection<String> generators = new HashSet<String>();
    try {

      final Process process = Runtime.getRuntime().exec(cmdline);
      final BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
      String s;
      do {
        s = in.readLine();
      } while (s != null && !s.startsWith("The following generators are available on this platform:"));

      while ((s = in.readLine()) != null) {
        final Matcher m = GENERATOR_PATTERN.matcher(s);
        if (!m.find()) continue;
        final String generator = m.group(1).trim();
        if (!StringUtil.isEmptyOrSpaces(generator)) {
          generators.add(generator);
        }
      }

      process.waitFor();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    return generators;
  }