forked from qt-creator/qt-creator
CMakePM: Improve CMake presets kit config hashing
Amends a3153c535d
QT_QMAKE_EXECUTABLE was not taken into consideration and this would
result in not matching kits.
Also Visual Studio generator will not have a CMAKE_C|XX_COMPILER values
in the cache.
On Windows there could be paths with "C:" vs "c:" and the hashes again
wouldn't match.
Change-Id: I5da5fafbd29f3d1fd8c9615c41b7659e63c30ff1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -1145,7 +1145,10 @@ void CMakeConfigurationKitAspect::setKitDefaultConfigHash(ProjectExplorer::Kit *
|
||||
expanded.value = item.expandedValue(k).toUtf8();
|
||||
return expanded;
|
||||
});
|
||||
const QByteArray kitHash = computeDefaultConfigHash(defaultConfigExpanded);
|
||||
const CMakeTool *const tool = CMakeKitAspect::cmakeTool(k);
|
||||
const QByteArray kitHash = computeDefaultConfigHash(defaultConfigExpanded,
|
||||
tool ? tool->cmakeExecutable()
|
||||
: FilePath());
|
||||
|
||||
CMakeConfig config = configuration(k);
|
||||
config.append(CMakeConfigItem(QTC_KIT_DEFAULT_CONFIG_HASH, CMakeConfigItem::INTERNAL, kitHash));
|
||||
@@ -1161,7 +1164,8 @@ CMakeConfigItem CMakeConfigurationKitAspect::kitDefaultConfigHashItem(const Proj
|
||||
});
|
||||
}
|
||||
|
||||
QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConfig &config)
|
||||
QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConfig &config,
|
||||
const FilePath &cmakeBinary)
|
||||
{
|
||||
const CMakeConfig defaultConfig = defaultConfiguration(nullptr);
|
||||
const QByteArray configValues = std::accumulate(defaultConfig.begin(),
|
||||
@@ -1171,7 +1175,11 @@ QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConf
|
||||
const CMakeConfigItem &item) {
|
||||
return sum += config.valueOf(item.key);
|
||||
});
|
||||
return QCryptographicHash::hash(configValues, QCryptographicHash::Md5).toHex();
|
||||
return QCryptographicHash::hash(cmakeBinary.caseSensitivity() == Qt::CaseInsensitive
|
||||
? configValues.toLower()
|
||||
: configValues,
|
||||
QCryptographicHash::Md5)
|
||||
.toHex();
|
||||
}
|
||||
|
||||
QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const
|
||||
|
||||
Reference in New Issue
Block a user