forked from qt-creator/qt-creator
CMake: Warn when doing out-of-source builds with in-source configuration
Warn when attempting to do an out-of-source build while an in-source build is configured. This seems to confuse cmake. Task-number: QTCREATORBUG-18381 Change-Id: I1abd3be4129ba5af6439dcd60d16d429b93c0382 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -217,6 +217,22 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warn if doing out-of-source builds with a CMakeCache.txt is the source directory
|
||||||
|
const Utils::FileName projectDirectory = bc->target()->project()->projectDirectory();
|
||||||
|
if (bc->buildDirectory() != projectDirectory) {
|
||||||
|
Utils::FileName cmc = projectDirectory;
|
||||||
|
cmc.appendPath("CMakeCache.txt");
|
||||||
|
if (cmc.exists()) {
|
||||||
|
emit addTask(Task(Task::Warning,
|
||||||
|
tr("There is a CMakeCache.txt file in \"%1\", which suggest an "
|
||||||
|
"in-source build was done before. You are now building in \"%2\", "
|
||||||
|
"and the CMakeCache.txt file might confuse CMake.")
|
||||||
|
.arg(projectDirectory.toUserOutput(), bc->buildDirectory().toUserOutput()),
|
||||||
|
Utils::FileName(), -1,
|
||||||
|
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString arguments = allArguments(rc);
|
QString arguments = allArguments(rc);
|
||||||
|
|
||||||
setIgnoreReturnValue(m_buildTarget == CMakeBuildStep::cleanTarget());
|
setIgnoreReturnValue(m_buildTarget == CMakeBuildStep::cleanTarget());
|
||||||
|
Reference in New Issue
Block a user