forked from qt-creator/qt-creator
CMake: Don't overwrite existing builds when changing build dir
When changing a build configuration's build directory to a directory with an existing build (i.e. CMakeCache.txt), do not overwrite it, but just parse it (running CMake as needed to generate the fileapi response). Do not ask funny questions in that case. This solves the pattern that you want to use some preconfigured build but configured the right kit already with the default parameters. Switching to a different build directory should simply never "kill" an existing build in any case (and running CMake with the "initial arguments" basically kills the existing build in the not-so-uncommon case). Change-Id: I54ca1f14d72a11a3bfe5b09ce340b28be321f80e Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -111,7 +111,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Utils::Id id)
|
||||
if (oldDir.isEmpty())
|
||||
return newDir;
|
||||
|
||||
if (QDir(oldDir).exists("CMakeCache.txt")) {
|
||||
if (QDir(oldDir).exists("CMakeCache.txt") && !QDir(newDir).exists("CMakeCache.txt")) {
|
||||
if (QMessageBox::information(nullptr,
|
||||
tr("Changing Build Directory"),
|
||||
tr("Change the build directory and start with a "
|
||||
|
||||
Reference in New Issue
Block a user