forked from qt-creator/qt-creator
CMakePM: Do not display duplicated build paths for presets
If we configure a project with presets, build all the configurations, then delete the CMakeLists.txt.user file to re-configure the presets, we shouldn't get two entries in the initial configuration dialog. Change-Id: I9bb234aa54fcce193dbd07dd3aa77e91f639b179 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -131,6 +131,20 @@ FilePaths CMakeProjectImporter::importCandidates()
|
|||||||
const FilePath configPresetDir = m_presetsTempDir.filePath(configPreset.name);
|
const FilePath configPresetDir = m_presetsTempDir.filePath(configPreset.name);
|
||||||
configPresetDir.createDir();
|
configPresetDir.createDir();
|
||||||
candidates << configPresetDir;
|
candidates << configPresetDir;
|
||||||
|
|
||||||
|
// If the binaryFilePath exists, do not try to import the existing build, so that
|
||||||
|
// we don't have duplicates, one from the preset and one from the previous configuration.
|
||||||
|
if (configPreset.binaryDir) {
|
||||||
|
Environment env = Environment::systemEnvironment();
|
||||||
|
CMakePresets::Macros::expand(configPreset, env, projectDirectory());
|
||||||
|
|
||||||
|
QString binaryDir = configPreset.binaryDir.value();
|
||||||
|
CMakePresets::Macros::expand(configPreset, env, projectDirectory(), binaryDir);
|
||||||
|
|
||||||
|
const FilePath binaryFilePath = FilePath::fromString(binaryDir);
|
||||||
|
candidates.removeIf(
|
||||||
|
[&binaryFilePath] (const FilePath &path) { return path == binaryFilePath; });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const FilePaths finalists = Utils::filteredUnique(candidates);
|
const FilePaths finalists = Utils::filteredUnique(candidates);
|
||||||
|
Reference in New Issue
Block a user