From 0e613918b63219b950efb03a8ebeb70aaeb870d5 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 9 Jun 2021 15:08:13 +0200 Subject: [PATCH] CMakePM: Always create build directories Having two configurations for a project, one in /tmp and one in the right build directory is confusing and for big projects can take some time. Fixes: QTCREATORBUG-25532 Change-Id: Ib0dad267117b3c025d668646ef076b0f77bff166 Reviewed-by: hjk --- .../cmakeprojectmanager/builddirparameters.h | 1 - .../cmakeprojectmanager/cmakebuildsystem.cpp | 65 +++++-------------- .../cmakeprojectmanager/cmakebuildsystem.h | 4 +- .../cmakeprojectmanager/cmakeprocess.cpp | 10 +-- .../cmakeprojectmanager/cmakesettingspage.cpp | 30 ++------- src/plugins/cmakeprojectmanager/cmaketool.cpp | 15 +---- src/plugins/cmakeprojectmanager/cmaketool.h | 1 - .../cmakeprojectmanager/fileapireader.cpp | 26 ++++---- 8 files changed, 42 insertions(+), 110 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/builddirparameters.h b/src/plugins/cmakeprojectmanager/builddirparameters.h index fa63b91bd53..7b990aaa56c 100644 --- a/src/plugins/cmakeprojectmanager/builddirparameters.h +++ b/src/plugins/cmakeprojectmanager/builddirparameters.h @@ -54,7 +54,6 @@ public: Utils::FilePath sourceDirectory; Utils::FilePath buildDirectory; - Utils::FilePath workDirectory; // either buildDirectory or a QTemporaryDirectory! QString cmakeBuildType; Utils::Environment environment; diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 1a223c07d8e..ddd12468821 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -273,7 +273,7 @@ void CMakeBuildSystem::triggerParsing() qCDebug(cmakeBuildSystemLog) << "Parse called with flags:" << reparseParametersString(reparseParameters); - const QString cache = m_parameters.workDirectory.pathAppended("CMakeCache.txt").toString(); + const QString cache = m_parameters.buildDirectory.pathAppended("CMakeCache.txt").toString(); if (!QFileInfo::exists(cache)) { reparseParameters |= REPARSE_FORCE_INITIAL_CONFIGURATION | REPARSE_FORCE_CMAKE_RUN; qCDebug(cmakeBuildSystemLog) @@ -402,7 +402,7 @@ void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &pa QTC_ASSERT(parameters.isValid(), return ); m_parameters = parameters; - m_parameters.workDirectory = workDirectory(parameters); + m_parameters.buildDirectory = buildDirectory(parameters); updateReparseParameters(reparseParameters); m_reader.setParameters(m_parameters); @@ -479,21 +479,20 @@ bool CMakeBuildSystem::persistCMakeState() BuildDirParameters parameters(cmakeBuildConfiguration()); QTC_ASSERT(parameters.isValid(), return false); - parameters.workDirectory = workDirectory(parameters); + const bool hadBuildDirectory = parameters.buildDirectory.exists(); + parameters.buildDirectory = buildDirectory(parameters); int reparseFlags = REPARSE_DEFAULT; qCDebug(cmakeBuildSystemLog) << "Checking whether build system needs to be persisted:" - << "workdir:" << parameters.workDirectory << "buildDir:" << parameters.buildDirectory << "Has extraargs:" << !parameters.extraCMakeArguments.isEmpty(); - if (parameters.workDirectory == parameters.buildDirectory + if (parameters.buildDirectory == parameters.buildDirectory && mustApplyExtraArguments(parameters)) { reparseFlags = REPARSE_FORCE_EXTRA_CONFIGURATION; qCDebug(cmakeBuildSystemLog) << " -> must run CMake with extra arguments."; } - if (parameters.workDirectory != parameters.buildDirectory - && buildConfiguration()->createBuildDirectory()) { + if (!hadBuildDirectory) { reparseFlags = REPARSE_FORCE_INITIAL_CONFIGURATION; qCDebug(cmakeBuildSystemLog) << " -> must run CMake with initial arguments."; } @@ -501,9 +500,6 @@ bool CMakeBuildSystem::persistCMakeState() if (reparseFlags == REPARSE_DEFAULT) return false; - if (reparseFlags == REPARSE_FORCE_INITIAL_CONFIGURATION) - parameters.workDirectory.clear(); - qCDebug(cmakeBuildSystemLog) << "Requesting parse to persist CMake State"; setParametersAndRequestParse(parameters, REPARSE_URGENT | REPARSE_FORCE_CMAKE_RUN | reparseFlags); @@ -518,11 +514,11 @@ void CMakeBuildSystem::clearCMakeCache() stopParsingAndClearState(); const QList pathsToDelete = { - m_parameters.workDirectory / "CMakeCache.txt", - m_parameters.workDirectory / "CMakeCache.txt.prev", - m_parameters.workDirectory / "CMakeFiles", - m_parameters.workDirectory / ".cmake/api/v1/reply", - m_parameters.workDirectory / ".cmake/api/v1/reply.prev" + m_parameters.buildDirectory / "CMakeCache.txt", + m_parameters.buildDirectory / "CMakeCache.txt.prev", + m_parameters.buildDirectory / "CMakeFiles", + m_parameters.buildDirectory / ".cmake/api/v1/reply", + m_parameters.buildDirectory / ".cmake/api/v1/reply.prev" }; for (const FilePath &path : pathsToDelete) { @@ -740,7 +736,7 @@ void CMakeBuildSystem::handleParsingSucceeded() m_buildTargets = Utils::transform(CMakeBuildStep::specialTargets(m_reader.usesAllCapsTargets()), [this](const QString &t) { CMakeBuildTarget result; result.title = t; - result.workingDirectory = m_parameters.workDirectory; + result.workingDirectory = m_parameters.buildDirectory; result.sourceDirectory = m_parameters.sourceDirectory; return result; }); @@ -863,40 +859,15 @@ void CMakeBuildSystem::wireUpConnections() } } -FilePath CMakeBuildSystem::workDirectory(const BuildDirParameters ¶meters) +FilePath CMakeBuildSystem::buildDirectory(const BuildDirParameters ¶meters) { const FilePath bdir = parameters.buildDirectory; - const CMakeTool *cmake = parameters.cmakeTool(); - // use the build directory if it already exists anyhow - if (bdir.exists()) { - m_buildDirToTempDir.erase(bdir); - return bdir; - } + if (!cmakeBuildConfiguration()->createBuildDirectory()) + handleParsingFailed( + tr("Failed to create build directory \"%1\".").arg(bdir.toUserOutput())); - // use the build directory if the cmake tool settings are set to automatically create them, - // or if the configuration was changed by the user - if ((cmake && cmake->autoCreateBuildDirectory()) || !parameters.extraCMakeArguments.isEmpty()) { - if (!cmakeBuildConfiguration()->createBuildDirectory()) - handleParsingFailed( - tr("Failed to create build directory \"%1\".").arg(bdir.toUserOutput())); - return bdir; - } - - auto tmpDirIt = m_buildDirToTempDir.find(bdir); - if (tmpDirIt == m_buildDirToTempDir.end()) { - auto ret = m_buildDirToTempDir.emplace( - std::make_pair(bdir, std::make_unique("qtc-cmake-XXXXXXXX"))); - QTC_ASSERT(ret.second, return bdir); - tmpDirIt = ret.first; - - if (!tmpDirIt->second->isValid()) { - handleParsingFailed(tr("Failed to create temporary directory \"%1\".") - .arg(QDir::toNativeSeparators(tmpDirIt->second->path()))); - return bdir; - } - } - return FilePath::fromString(tmpDirIt->second->path()); + return bdir; } void CMakeBuildSystem::stopParsingAndClearState() @@ -941,7 +912,7 @@ void CMakeBuildSystem::runCTest() QTC_ASSERT(parameters.isValid(), return); const CommandLine cmd { m_ctestPath, { "-N", "--show-only=json-v1" } }; - const QString workingDirectory = workDirectory(parameters).toString(); + const QString workingDirectory = buildDirectory(parameters).toString(); const QStringList environment = cmakeBuildConfiguration()->environment().toStringList(); auto future = Utils::runAsync([cmd, workingDirectory, environment] diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.h b/src/plugins/cmakeprojectmanager/cmakebuildsystem.h index 2cda4a6ab63..27446052b54 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.h @@ -149,7 +149,7 @@ private: void wireUpConnections(); - Utils::FilePath workDirectory(const BuildDirParameters ¶meters); + Utils::FilePath buildDirectory(const BuildDirParameters ¶meters); void stopParsingAndClearState(); void becameDirty(); @@ -175,8 +175,6 @@ private: // Parsing state: BuildDirParameters m_parameters; int m_reparseParameters = REPARSE_DEFAULT; - mutable std::unordered_map> - m_buildDirToTempDir; FileApiReader m_reader; mutable bool m_isHandlingError = false; diff --git a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp index fdbb7994d9d..843b4d3d687 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp @@ -86,8 +86,8 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList & CMakeTool *cmake = parameters.cmakeTool(); QTC_ASSERT(parameters.isValid() && cmake, return); - const Utils::FilePath workDirectory = parameters.workDirectory; - QTC_ASSERT(workDirectory.exists(), return); + const Utils::FilePath buildDirectory = parameters.buildDirectory; + QTC_ASSERT(buildDirectory.exists(), return); const QString srcDir = parameters.sourceDirectory.path(); @@ -103,7 +103,7 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList & m_cancelTimer.start(); - process->setWorkingDirectory(workDirectory); + process->setWorkingDirectory(buildDirectory); process->setEnvironment(parameters.environment); connect(process.get(), &QtcProcess::readyReadStandardOutput, @@ -113,12 +113,12 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList & connect(process.get(), &QtcProcess::finished, this, &CMakeProcess::handleProcessFinished); - CommandLine commandLine(cmake->cmakeExecutable(), QStringList({"-S", srcDir, "-B", workDirectory.path()}) + arguments); + CommandLine commandLine(cmake->cmakeExecutable(), QStringList({"-S", srcDir, "-B", buildDirectory.path()}) + arguments); TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM); BuildSystem::startNewBuildSystemOutput( - tr("Running %1 in %2.").arg(commandLine.toUserOutput()).arg(workDirectory.toUserOutput())); + tr("Running %1 in %2.").arg(commandLine.toUserOutput()).arg(buildDirectory.toUserOutput())); auto future = std::make_unique>(); future->setProgressRange(0, 1); diff --git a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp index 6a8edb5269a..74bcc1b747e 100644 --- a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp +++ b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp @@ -77,7 +77,6 @@ public: const FilePath &executable, const FilePath &qchFile, const bool autoRun, - const bool autoCreate, const bool isAutoDetected); void addCMakeTool(const CMakeTool *item, bool changed); TreeItem *autoGroupItem() const; @@ -87,8 +86,7 @@ public: const QString &displayName, const FilePath &executable, const FilePath &qchFile, - bool autoRun, - bool autoCreate); + bool autoRun); void removeCMakeTool(const Utils::Id &id); void apply(); @@ -112,7 +110,6 @@ public: , m_executable(item->filePath()) , m_qchFile(item->qchFilePath()) , m_isAutoRun(item->isAutoRun()) - , m_autoCreateBuildDirectory(item->autoCreateBuildDirectory()) , m_autodetected(item->isAutoDetected()) , m_isSupported(item->hasFileApi()) , m_changed(changed) @@ -124,14 +121,12 @@ public: const FilePath &executable, const FilePath &qchFile, bool autoRun, - bool autoCreate, bool autodetected) : m_id(Utils::Id::fromString(QUuid::createUuid().toString())) , m_name(name) , m_executable(executable) , m_qchFile(qchFile) , m_isAutoRun(autoRun) - , m_autoCreateBuildDirectory(autoCreate) , m_autodetected(autodetected) { updateErrorFlags(); @@ -229,7 +224,6 @@ public: bool m_pathExists = false; bool m_pathIsFile = false; bool m_pathIsExecutable = false; - bool m_autoCreateBuildDirectory = false; bool m_autodetected = false; bool m_isSupported = false; bool m_changed = true; @@ -259,10 +253,9 @@ QModelIndex CMakeToolItemModel::addCMakeTool(const QString &name, const FilePath &executable, const FilePath &qchFile, const bool autoRun, - const bool autoCreate, const bool isAutoDetected) { - auto item = new CMakeToolTreeItem(name, executable, qchFile, autoRun, autoCreate, isAutoDetected); + auto item = new CMakeToolTreeItem(name, executable, qchFile, autoRun, isAutoDetected); if (isAutoDetected) autoGroupItem()->appendChild(item); else @@ -317,8 +310,7 @@ void CMakeToolItemModel::updateCMakeTool(const Utils::Id &id, const QString &displayName, const FilePath &executable, const FilePath &qchFile, - bool autoRun, - bool autoCreate) + bool autoRun) { CMakeToolTreeItem *treeItem = cmakeToolItem(id); QTC_ASSERT(treeItem, return ); @@ -327,7 +319,6 @@ void CMakeToolItemModel::updateCMakeTool(const Utils::Id &id, treeItem->m_executable = executable; treeItem->m_qchFile = qchFile; treeItem->m_isAutoRun = autoRun; - treeItem->m_autoCreateBuildDirectory = autoCreate; treeItem->updateErrorFlags(); @@ -369,7 +360,6 @@ void CMakeToolItemModel::apply() cmake->setFilePath(item->m_executable); cmake->setQchFilePath(item->m_qchFile); cmake->setAutorun(item->m_isAutoRun); - cmake->setAutoCreateBuildDirectory(item->m_autoCreateBuildDirectory); } else { toRegister.append(item); } @@ -438,7 +428,6 @@ private: CMakeToolItemModel *m_model; QLineEdit *m_displayNameLineEdit; QCheckBox *m_autoRunCheckBox; - QCheckBox *m_autoCreateBuildDirectoryCheckBox; PathChooser *m_binaryChooser; PathChooser *m_qchFileChooser; Utils::Id m_id; @@ -467,17 +456,12 @@ CMakeToolItemConfigWidget::CMakeToolItemConfigWidget(CMakeToolItemModel *model) m_autoRunCheckBox->setText(tr("Autorun CMake")); m_autoRunCheckBox->setToolTip(tr("Automatically run CMake after changes to CMake project files.")); - m_autoCreateBuildDirectoryCheckBox = new QCheckBox; - m_autoCreateBuildDirectoryCheckBox->setText(tr("Auto-create build directories")); - m_autoCreateBuildDirectoryCheckBox->setToolTip(tr("Automatically create build directories for CMake projects.")); - auto formLayout = new QFormLayout(this); formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); formLayout->addRow(new QLabel(tr("Name:")), m_displayNameLineEdit); formLayout->addRow(new QLabel(tr("Path:")), m_binaryChooser); formLayout->addRow(new QLabel(tr("Help file:")), m_qchFileChooser); formLayout->addRow(m_autoRunCheckBox); - formLayout->addRow(m_autoCreateBuildDirectoryCheckBox); connect(m_binaryChooser, &PathChooser::rawPathChanged, this, [this]() { updateQchFilePath(); @@ -488,8 +472,6 @@ CMakeToolItemConfigWidget::CMakeToolItemConfigWidget(CMakeToolItemModel *model) connect(m_displayNameLineEdit, &QLineEdit::textChanged, this, &CMakeToolItemConfigWidget::store); connect(m_autoRunCheckBox, &QCheckBox::toggled, this, &CMakeToolItemConfigWidget::store); - connect(m_autoCreateBuildDirectoryCheckBox, &QCheckBox::toggled, - this, &CMakeToolItemConfigWidget::store); } void CMakeToolItemConfigWidget::store() const @@ -499,8 +481,7 @@ void CMakeToolItemConfigWidget::store() const m_displayNameLineEdit->text(), m_binaryChooser->filePath(), m_qchFileChooser->filePath(), - m_autoRunCheckBox->checkState() == Qt::Checked, - m_autoCreateBuildDirectoryCheckBox->checkState() == Qt::Checked); + m_autoRunCheckBox->checkState() == Qt::Checked); } void CMakeToolItemConfigWidget::updateQchFilePath() @@ -530,7 +511,6 @@ void CMakeToolItemConfigWidget::load(const CMakeToolTreeItem *item) m_qchFileChooser->setFilePath(item->m_qchFile); m_autoRunCheckBox->setChecked(item->m_isAutoRun); - m_autoCreateBuildDirectoryCheckBox->setChecked(item->m_autoCreateBuildDirectory); m_id = item->m_id; m_loadingItem = false; @@ -641,7 +621,6 @@ void CMakeToolConfigWidget::cloneCMakeTool() m_currentItem->m_executable, m_currentItem->m_qchFile, m_currentItem->m_isAutoRun, - m_currentItem->m_autoCreateBuildDirectory, false); m_cmakeToolsView->setCurrentIndex(newItem); @@ -653,7 +632,6 @@ void CMakeToolConfigWidget::addCMakeTool() FilePath(), FilePath(), true, - false, false); m_cmakeToolsView->setCurrentIndex(newItem); diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index 3df37193d76..56924a90cd3 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -50,6 +50,7 @@ const char CMAKE_INFORMATION_COMMAND[] = "Binary"; const char CMAKE_INFORMATION_DISPLAYNAME[] = "DisplayName"; const char CMAKE_INFORMATION_AUTORUN[] = "AutoRun"; const char CMAKE_INFORMATION_QCH_FILE_PATH[] = "QchFile"; +// obsolete since Qt Creator 5. Kept for backward compatibility const char CMAKE_INFORMATION_AUTO_CREATE_BUILD_DIRECTORY[] = "AutoCreateBuildDirectory"; const char CMAKE_INFORMATION_AUTODETECTED[] = "AutoDetected"; const char CMAKE_INFORMATION_READERTYPE[] = "ReaderType"; @@ -172,15 +173,6 @@ void CMakeTool::setAutorun(bool autoRun) CMakeToolManager::notifyAboutUpdate(this); } -void CMakeTool::setAutoCreateBuildDirectory(bool autoBuildDir) -{ - if (m_autoCreateBuildDirectory == autoBuildDir) - return; - - m_autoCreateBuildDirectory = autoBuildDir; - CMakeToolManager::notifyAboutUpdate(this); -} - bool CMakeTool::isValid() const { if (!m_id.isValid() || !m_introspection) @@ -265,11 +257,6 @@ bool CMakeTool::isAutoRun() const return m_isAutoRun; } -bool CMakeTool::autoCreateBuildDirectory() const -{ - return m_autoCreateBuildDirectory; -} - QList CMakeTool::supportedGenerators() const { return isValid() ? m_introspection->m_generators : QList(); diff --git a/src/plugins/cmakeprojectmanager/cmaketool.h b/src/plugins/cmakeprojectmanager/cmaketool.h index 4ffc8c82a0c..cb249bbd53d 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.h +++ b/src/plugins/cmakeprojectmanager/cmaketool.h @@ -83,7 +83,6 @@ public: QVariantMap toMap () const; void setAutorun(bool autoRun); - void setAutoCreateBuildDirectory(bool autoBuildDir); void setFilePath(const Utils::FilePath &executable); Utils::FilePath filePath() const; diff --git a/src/plugins/cmakeprojectmanager/fileapireader.cpp b/src/plugins/cmakeprojectmanager/fileapireader.cpp index 027541e97f0..274fe2f39cf 100644 --- a/src/plugins/cmakeprojectmanager/fileapireader.cpp +++ b/src/plugins/cmakeprojectmanager/fileapireader.cpp @@ -77,13 +77,13 @@ void FileApiReader::setParameters(const BuildDirParameters &p) // Update: m_parameters = p; - qCDebug(cmakeFileApiMode) << "Work directory:" << m_parameters.workDirectory.toUserOutput(); + qCDebug(cmakeFileApiMode) << "Work directory:" << m_parameters.buildDirectory.toUserOutput(); // Reset watcher: m_watcher.removeFiles(m_watcher.files()); m_watcher.removeDirectories(m_watcher.directories()); - FileApiParser::setupCMakeFileApi(m_parameters.workDirectory, m_watcher); + FileApiParser::setupCMakeFileApi(m_parameters.buildDirectory, m_watcher); resetData(); } @@ -116,7 +116,7 @@ void FileApiReader::parse(bool forceCMakeRun, : QStringList()); qCDebug(cmakeFileApiMode) << "Parameters request these CMake arguments:" << args; - const FilePath replyFile = FileApiParser::scanForCMakeReplyFile(m_parameters.workDirectory); + const FilePath replyFile = FileApiParser::scanForCMakeReplyFile(m_parameters.buildDirectory); // Only need to update when one of the following conditions is met: // * The user forces the cmake run, // * The user provided arguments, @@ -130,7 +130,7 @@ void FileApiReader::parse(bool forceCMakeRun, && anyOf(m_cmakeFiles, [&replyFile](const FilePath &f) { return f.lastModified() > replyFile.lastModified(); }); - const bool queryFileChanged = anyOf(FileApiParser::cmakeQueryFilePaths(m_parameters.workDirectory), + const bool queryFileChanged = anyOf(FileApiParser::cmakeQueryFilePaths(m_parameters.buildDirectory), [&replyFile](const FilePath &qf) { return qf.lastModified() > replyFile.lastModified(); }); @@ -249,7 +249,7 @@ void FileApiReader::endState(const FilePath &replyFilePath) QTC_ASSERT(!m_future.has_value(), return ); const FilePath sourceDirectory = m_parameters.sourceDirectory; - const FilePath buildDirectory = m_parameters.workDirectory; + const FilePath buildDirectory = m_parameters.buildDirectory; const FilePath topCmakeFile = m_cmakeFiles.size() == 1 ? *m_cmakeFiles.begin() : FilePath{}; const QString cmakeBuildType = m_parameters.cmakeBuildType == "Build" ? "" : m_parameters.cmakeBuildType; @@ -304,8 +304,8 @@ void FileApiReader::endState(const FilePath &replyFilePath) void FileApiReader::makeBackupConfiguration(bool store) { - FilePath reply = m_parameters.workDirectory.pathAppended(".cmake/api/v1/reply"); - FilePath replyPrev = m_parameters.workDirectory.pathAppended(".cmake/api/v1/reply.prev"); + FilePath reply = m_parameters.buildDirectory.pathAppended(".cmake/api/v1/reply"); + FilePath replyPrev = m_parameters.buildDirectory.pathAppended(".cmake/api/v1/reply.prev"); if (!store) std::swap(reply, replyPrev); @@ -319,8 +319,8 @@ void FileApiReader::makeBackupConfiguration(bool store) } - FilePath cmakeCacheTxt = m_parameters.workDirectory.pathAppended("CMakeCache.txt"); - FilePath cmakeCacheTxtPrev = m_parameters.workDirectory.pathAppended("CMakeCache.txt.prev"); + FilePath cmakeCacheTxt = m_parameters.buildDirectory.pathAppended("CMakeCache.txt"); + FilePath cmakeCacheTxtPrev = m_parameters.buildDirectory.pathAppended("CMakeCache.txt.prev"); if (!store) std::swap(cmakeCacheTxt, cmakeCacheTxtPrev); @@ -333,7 +333,7 @@ void FileApiReader::makeBackupConfiguration(bool store) void FileApiReader::writeConfigurationIntoBuildDirectory(const QStringList &configurationArguments) { - const FilePath buildDir = m_parameters.workDirectory; + const FilePath buildDir = m_parameters.buildDirectory; QTC_ASSERT(buildDir.exists(), buildDir.ensureWritableDir()); if (!buildDir.exists()) buildDir.ensureWritableDir(); @@ -384,9 +384,9 @@ void FileApiReader::cmakeFinishedState() if (m_lastCMakeExitCode != 0) makeBackupConfiguration(false); - FileApiParser::setupCMakeFileApi(m_parameters.workDirectory, m_watcher); + FileApiParser::setupCMakeFileApi(m_parameters.buildDirectory, m_watcher); - endState(FileApiParser::scanForCMakeReplyFile(m_parameters.workDirectory)); + endState(FileApiParser::scanForCMakeReplyFile(m_parameters.buildDirectory)); } void FileApiReader::replyDirectoryHasChanged(const QString &directory) const @@ -394,7 +394,7 @@ void FileApiReader::replyDirectoryHasChanged(const QString &directory) const if (m_isParsing) return; // This has been triggered by ourselves, ignore. - const FilePath reply = FileApiParser::scanForCMakeReplyFile(m_parameters.workDirectory); + const FilePath reply = FileApiParser::scanForCMakeReplyFile(m_parameters.buildDirectory); const FilePath dir = reply.absolutePath(); if (dir.isEmpty()) return; // CMake started to fill the result dir, but has not written a result file yet