CMakePM: Set proper source directory for targets using FOLDER property

The correct source directory needs to be set as file path for the target
node.

The value of the FOLDER property was seen as a relative path and the
<build-directory>/<FOLDER> was used, which was very wrong.

Fixes: QTCREATORBUG-32194
Change-Id: I138b99e391b51fe872f75c6e479ccc34c08ff270
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2024-12-19 16:22:28 +01:00
parent 2a17e4adde
commit d16474ae80
2 changed files with 4 additions and 0 deletions

View File

@@ -72,6 +72,7 @@ public:
void setVisibleAfterAddFileAction(bool visibleAfterAddFileAction);
using ProjectExplorer::Node::setFilePath;
private:
QString m_tooltip;
Utils::FilePath m_buildDirectory;

View File

@@ -825,6 +825,9 @@ static void addTargets(FolderNode *root,
folderDir, createSourceGroupNode(td.folderTargetProperty, folderDir, root));
tNode = createTargetNode(folderNodes, folderDir, t.name);
// Set the correct source directory, not the FOLDER property value
tNode->setFilePath(dir);
} else {
tNode = createTargetNode(cmakeListsNodes, dir, t.name);
}