CMakePM: Do not show source/group/path twice

For the cases of:
  source_group(TREE ${CMAKE_SOURCE_DIR} FILES my/subdir/file.cpp)

Treat the "my\\subdir" part in the project view as part of the source
group name.

Fixes: QTCREATORBUG-29799
Change-Id: I92bf581be25d085783bcdadd8a418b849a29c708
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2023-11-16 16:36:21 +01:00
parent eb45df8349
commit 7affb80fc3

View File

@@ -664,7 +664,10 @@ static void addCompileGroups(ProjectNode *targetRoot,
sourceDirectory, sourceDirectory,
targetRoot); targetRoot);
if (showSourceFolders) { if (showSourceFolders) {
insertNode->addNestedNodes(std::move(current), sourceDirectory); FilePath baseDir = sourceDirectory.pathAppended(td.sourceGroups[i]);
if (!baseDir.exists())
baseDir = sourceDirectory;
insertNode->addNestedNodes(std::move(current), baseDir);
} else { } else {
for (auto &fileNodes : current) for (auto &fileNodes : current)
insertNode->addNode(std::move(fileNodes)); insertNode->addNode(std::move(fileNodes));