CMake: correctly track remote cmake files

Change-Id: I6685ed7ba77282d9d5154ba4192841f5bd093783
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
David Schulz
2021-09-09 15:50:19 +02:00
parent 99790aaa42
commit ed8b87d4f6
2 changed files with 4 additions and 8 deletions

View File

@@ -67,12 +67,8 @@ CMakeFileResult extractCMakeFilesData(const std::vector<CMakeFileInfo> &cmakefil
{
CMakeFileResult result;
QDir sourceDir(sourceDirectory.toString());
QDir buildDir(buildDirectory.toString());
for (const CMakeFileInfo &info : cmakefiles) {
const FilePath sfn = FilePath::fromString(
QDir::cleanPath(sourceDir.absoluteFilePath(info.path.toString())));
const FilePath sfn = sourceDirectory.resolvePath(info.path);
const int oldCount = result.cmakeFiles.count();
CMakeFileInfo absolute(info);
absolute.path = sfn;
@@ -93,9 +89,9 @@ CMakeFileResult extractCMakeFilesData(const std::vector<CMakeFileInfo> &cmakefil
if (info.isCMakeListsDotTxt) {
result.cmakeListNodes.emplace_back(std::move(node));
} else if (sfn.isChildOf(sourceDir)) {
} else if (sfn.isChildOf(sourceDirectory)) {
result.cmakeNodesSource.emplace_back(std::move(node));
} else if (sfn.isChildOf(buildDir)) {
} else if (sfn.isChildOf(buildDirectory)) {
result.cmakeNodesBuild.emplace_back(std::move(node));
} else {
result.cmakeNodesOther.emplace_back(std::move(node));

View File

@@ -245,7 +245,7 @@ static std::vector<CMakeFileInfo> readCMakeFilesFile(const FilePath &cmakeFilesF
for (const QJsonValue &v : inputs) {
CMakeFileInfo info;
const QJsonObject input = v.toObject();
info.path = FilePath::fromString(input.value("path").toString());
info.path = cmakeFilesFile.withNewPath(input.value("path").toString());
info.isCMake = input.value("isCMake").toBool();
const QString filename = info.path.fileName();