| 458 | } |
| 459 | |
| 460 | QHash<QString, QString> readCacheValues(const KDevelop::Path& cmakeCachePath, QSet<QString> variables) |
| 461 | { |
| 462 | QHash<QString, QString> ret; |
| 463 | QFile file(cmakeCachePath.toLocalFile()); |
| 464 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { |
| 465 | qCWarning(CMAKE) << "couldn't open CMakeCache.txt" << cmakeCachePath; |
| 466 | return ret; |
| 467 | } |
| 468 | |
| 469 | QTextStream in(&file); |
| 470 | while (!in.atEnd() && !variables.isEmpty()) |
| 471 | { |
| 472 | QString line = in.readLine().trimmed(); |
| 473 | if(!line.isEmpty() && line[0].isLetter()) |
| 474 | { |
| 475 | CacheLine c; |
| 476 | c.readLine(line); |
| 477 | |
| 478 | if(!c.isCorrect()) |
| 479 | continue; |
| 480 | |
| 481 | if (variables.remove(c.name())) { |
| 482 | ret[c.name()] = c.value(); |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | return ret; |
| 487 | } |
| 488 | |
| 489 | void updateConfig( KDevelop::IProject* project, int buildDirIndex) |
| 490 | { |