From d16474ae80d809843f910f60ede293f6da2c906c Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 19 Dec 2024 16:22:28 +0100 Subject: [PATCH] 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 / was used, which was very wrong. Fixes: QTCREATORBUG-32194 Change-Id: I138b99e391b51fe872f75c6e479ccc34c08ff270 Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakeprojectnodes.h | 1 + src/plugins/cmakeprojectmanager/fileapidataextractor.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h index 74718944017..ad0af9db4b3 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h @@ -72,6 +72,7 @@ public: void setVisibleAfterAddFileAction(bool visibleAfterAddFileAction); + using ProjectExplorer::Node::setFilePath; private: QString m_tooltip; Utils::FilePath m_buildDirectory; diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index 0d8a9e71f01..9ef2d86e8ef 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -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); }