CMake: Improve detection of build directory in server-mode

Detect both build directories next to the sources as well as below the source
directory properly. Without this patch all files that normally go into "Build
Directory" node were listed below "Source Directory" when the build directory
was a child of the source directory.

Task-number: QTCREATORBUG-18196
Change-Id: Ib8674489cfe04958f76df24904107bb7aa093162
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2017-05-12 12:29:54 +02:00
parent d0f3f7f7e5
commit 112254dc67

View File

@@ -702,14 +702,15 @@ void ServerModeReader::addFileGroups(ProjectNode *targetRoot,
}
// Split up files in groups (based on location):
const bool inSourceBuild = (m_parameters.buildDirectory == m_parameters.sourceDirectory);
QList<FileNode *> sourceFileNodes;
QList<FileNode *> buildFileNodes;
QList<FileNode *> otherFileNodes;
foreach (FileNode *fn, toList) {
if (fn->filePath().isChildOf(m_parameters.sourceDirectory))
sourceFileNodes.append(fn);
else if (fn->filePath().isChildOf(m_parameters.buildDirectory))
if (fn->filePath().isChildOf(m_parameters.buildDirectory) && !inSourceBuild)
buildFileNodes.append(fn);
else if (fn->filePath().isChildOf(m_parameters.sourceDirectory))
sourceFileNodes.append(fn);
else
otherFileNodes.append(fn);
}