CMakePM: Consider all the missing expandable CMake variables

CMAKE_PREFIX_PATH and CMAKE_FIND_ROOT_PATH can have multiple
values, and now all the values are taken into account.

Ammends e1a68f2598 which had only
one value with all the items separated by semicolon.

Change-Id: I88d98fbbf165e7e61d70ab4a4e84eb4de4cc9f82
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Cristian Adam
2021-07-20 19:58:05 +02:00
parent 7ef50ec70c
commit 366b4c0199

View File

@@ -1299,20 +1299,23 @@ void CMakeBuildSystem::updateInitialCMakeExpandableVars()
});
if (it != cm.cend()) {
const QByteArray initialValue = CMakeConfigItem::expandedValueOf(kit(), var, initialConfig).toUtf8();
const FilePath initialPath = FilePath::fromString(QString::fromUtf8(initialValue));
const QByteArrayList initialValueList = CMakeConfigItem::expandedValueOf(kit(), var, initialConfig).toUtf8().split(';');
const bool pathIsContained
= Utils::contains(it->value.split(';'), [samePath, initialPath](const QByteArray &p) {
return samePath(FilePath::fromString(QString::fromUtf8(p)), initialPath);
});
if (!initialValue.isEmpty() && !pathIsContained) {
CMakeConfigItem item(*it);
item.value = initialValue;
item.value.append(";");
item.value.append(it->value);
for (const auto &initialValue: initialValueList) {
const FilePath initialPath = FilePath::fromString(QString::fromUtf8(initialValue));
config << item;
const bool pathIsContained
= Utils::contains(it->value.split(';'), [samePath, initialPath](const QByteArray &p) {
return samePath(FilePath::fromString(QString::fromUtf8(p)), initialPath);
});
if (!initialValue.isEmpty() && !pathIsContained) {
CMakeConfigItem item(*it);
item.value = initialValue;
item.value.append(";");
item.value.append(it->value);
config << item;
}
}
}
}