Commit 7a7a12ce authored by Tobias Hunger's avatar Tobias Hunger

CMake: Fix build directory

Fix use of build directory vs. workdirectory in tealeafreader and servermode
reader.

Change-Id: I593579f7ad4facd64cf201368cacc4d3a8414fbf
Reviewed-by: Friedemann Kleint's avatarFriedemann Kleint <Friedemann.Kleint@qt.io>
parent 6138bc3d
......@@ -323,7 +323,7 @@ void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
const FileName path = fn->filePath();
if (path.fileName().compare("CMakeLists.txt", HostOsInfo::fileNameCaseSensitivity()) == 0)
cmakeLists.append(fn);
else if (path.isChildOf(m_parameters.buildDirectory))
else if (path.isChildOf(m_parameters.workDirectory))
cmakeFilesBuild.append(fn);
else if (path.isChildOf(m_parameters.sourceDirectory))
cmakeFilesSource.append(fn);
......@@ -345,7 +345,7 @@ void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
addHeaderNodes(root, knownHeaders, allFiles);
if (!cmakeFilesSource.isEmpty() || !cmakeFilesBuild.isEmpty() || !cmakeFilesOther.isEmpty())
addCMakeInputs(root, m_parameters.sourceDirectory, m_parameters.buildDirectory,
addCMakeInputs(root, m_parameters.sourceDirectory, m_parameters.workDirectory,
cmakeFilesSource, cmakeFilesBuild, cmakeFilesOther);
}
......@@ -859,12 +859,12 @@ void ServerModeReader::addFileGroups(ProjectNode *targetRoot,
}
// Split up files in groups (based on location):
const bool inSourceBuild = (m_parameters.buildDirectory == m_parameters.sourceDirectory);
const bool inSourceBuild = (m_parameters.workDirectory == m_parameters.sourceDirectory);
QList<FileNode *> sourceFileNodes;
QList<FileNode *> buildFileNodes;
QList<FileNode *> otherFileNodes;
foreach (FileNode *fn, toList) {
if (fn->filePath().isChildOf(m_parameters.buildDirectory) && !inSourceBuild)
if (fn->filePath().isChildOf(m_parameters.workDirectory) && !inSourceBuild)
buildFileNodes.append(fn);
else if (fn->filePath().isChildOf(m_parameters.sourceDirectory))
sourceFileNodes.append(fn);
......
......@@ -192,7 +192,7 @@ static QString findCbpFile(const QDir &directory)
void TeaLeafReader::parse(bool forceConfiguration)
{
const QString cbpFile = findCbpFile(QDir(m_parameters.buildDirectory.toString()));
const QString cbpFile = findCbpFile(QDir(m_parameters.workDirectory.toString()));
const QFileInfo cbpFileFi = cbpFile.isEmpty() ? QFileInfo() : QFileInfo(cbpFile);
if (!cbpFileFi.exists() || forceConfiguration) {
// Initial create:
......@@ -236,7 +236,7 @@ QList<CMakeBuildTarget> TeaLeafReader::takeBuildTargets()
CMakeConfig TeaLeafReader::takeParsedConfiguration()
{
FileName cacheFile = m_parameters.buildDirectory;
FileName cacheFile = m_parameters.workDirectory;
cacheFile.appendPath(QLatin1String("CMakeCache.txt"));
if (!cacheFile.exists())
......@@ -366,7 +366,7 @@ void TeaLeafReader::updateCodeModel(CppTools::RawProjectParts &rpps)
} else {
includePaths = transform(cbt.includeFiles, &FileName::toString);
}
includePaths += m_parameters.buildDirectory.toString();
includePaths += m_parameters.workDirectory.toString();
CppTools::RawProjectPart rpp;
rpp.setProjectFileLocation(cbt.sourceDirectory.toString() + "/CMakeLists.txt");
rpp.setBuildSystemTarget(cbt.title);
......@@ -411,7 +411,7 @@ void TeaLeafReader::extractData()
QTC_ASSERT(m_parameters.isValid() && m_parameters.cmakeTool, return);
const FileName srcDir = m_parameters.sourceDirectory;
const FileName bldDir = m_parameters.buildDirectory;
const FileName bldDir = m_parameters.workDirectory;
const FileName topCMake = Utils::FileName(srcDir).appendPath("CMakeLists.txt");
resetData();
......@@ -427,7 +427,7 @@ void TeaLeafReader::extractData()
m_cmakeFiles.insert(cbpFile);
// Add CMakeCache.txt file:
FileName cacheFile = m_parameters.buildDirectory;
FileName cacheFile = m_parameters.workDirectory;
cacheFile.appendPath(QLatin1String("CMakeCache.txt"));
if (cacheFile.toFileInfo().exists())
m_cmakeFiles.insert(cacheFile);
......@@ -460,11 +460,11 @@ void TeaLeafReader::startCMake(const QStringList &configurationArguments)
{
QTC_ASSERT(m_parameters.isValid() && m_parameters.cmakeTool, return);
const FileName buildDirectory = m_parameters.buildDirectory;
const FileName workDirectory = m_parameters.workDirectory;
QTC_ASSERT(!m_cmakeProcess, return);
QTC_ASSERT(!m_parser, return);
QTC_ASSERT(!m_future, return);
QTC_ASSERT(buildDirectory.exists(), return);
QTC_ASSERT(workDirectory.exists(), return);
const QString srcDir = m_parameters.sourceDirectory.toString();
......@@ -485,7 +485,7 @@ void TeaLeafReader::startCMake(const QStringList &configurationArguments)
// then we are racing against CMakeCache.txt also getting deleted.
m_cmakeProcess = new QtcProcess;
m_cmakeProcess->setWorkingDirectory(buildDirectory.toString());
m_cmakeProcess->setWorkingDirectory(workDirectory.toString());
m_cmakeProcess->setEnvironment(m_parameters.environment);
connect(m_cmakeProcess, &QProcess::readyReadStandardOutput,
......@@ -505,7 +505,7 @@ void TeaLeafReader::startCMake(const QStringList &configurationArguments)
MessageManager::write(tr("Running \"%1 %2\" in %3.")
.arg(m_parameters.cmakeTool->cmakeExecutable().toUserOutput())
.arg(args)
.arg(buildDirectory.toUserOutput()));
.arg(workDirectory.toUserOutput()));
m_future = new QFutureInterface<void>();
m_future->setProgressRange(0, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment