MCPcopy Create free account
hub / github.com/KDE/kdevelop / updateConfig

Function updateConfig

plugins/cmake/cmakeutils.cpp:489–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487}
488
489void updateConfig( KDevelop::IProject* project, int buildDirIndex)
490{
491 if (buildDirIndex < 0)
492 return;
493
494 KConfigGroup buildDirGrp = buildDirGroup( project, buildDirIndex );
495 const KDevelop::Path builddir(buildDirGrp.readEntry( Config::Specific::buildDirPathKey, QString() ));
496 const KDevelop::Path cacheFilePath( builddir, QStringLiteral("CMakeCache.txt"));
497
498 const QMap<QString, const char*> keys = {
499 { QStringLiteral("CMAKE_COMMAND"), Config::Specific::cmakeExecutableKey },
500 { QStringLiteral("CMAKE_INSTALL_PREFIX"), Config::Specific::cmakeInstallDirKey },
501 { QStringLiteral("CMAKE_BUILD_TYPE"), Config::Specific::cmakeBuildTypeKey }
502 };
503
504 const QSet<QString> variables(keys.keyBegin(), keys.keyEnd());
505 const QHash<QString, QString> cacheValues = readCacheValues(cacheFilePath, variables);
506 for(auto it = cacheValues.constBegin(), itEnd = cacheValues.constEnd(); it!=itEnd; ++it) {
507 const char* const key = keys.value(it.key());
508 Q_ASSERT(key);
509
510 // Use cache only when the config value is not set. Without this check we will always
511 // overwrite values provided by the user in config dialog.
512 if (buildDirGrp.readEntry(key).isEmpty() && !it.value().isEmpty())
513 {
514 buildDirGrp.writeEntry( key, it.value() );
515 }
516 }
517}
518
519void setOverrideBuildDirIndex( KDevelop::IProject* project, int overrideBuildDirIndex )
520{

Callers 1

startMethod · 0.85

Calls 10

buildDirGroupFunction · 0.85
readCacheValuesFunction · 0.85
readEntryMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
writeEntryMethod · 0.80
QStringClass · 0.70
valueMethod · 0.45
keyMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected