CMakePM: Do not use systemEnvironment() for CMakePresets

This doesn't mean that CMakePresets will work with a remote project, but
at least it avoids Environment::systemEnvironment() usage.

Change-Id: I17081c747d32e50224ac74507d3aa336ff5c8948
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Cristian Adam
2022-10-18 18:23:50 +02:00
parent fdee55643a
commit 1c51dc1adf
2 changed files with 6 additions and 6 deletions

View File

@@ -135,7 +135,7 @@ FilePaths CMakeProjectImporter::importCandidates()
// 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();
Environment env = projectDirectory().deviceEnvironment();
CMakePresets::Macros::expand(configPreset, env, projectDirectory());
QString binaryDir = configPreset.binaryDir.value();
@@ -165,15 +165,15 @@ static CMakeConfig configurationFromPresetProbe(
cmake.setTimeoutS(30);
cmake.setDisableUnixTerminal();
Environment env = Environment::systemEnvironment();
const FilePath cmakeExecutable = FilePath::fromString(configurePreset.cmakeExecutable.value());
Environment env = cmakeExecutable.deviceEnvironment();
CMakePresets::Macros::expand(configurePreset, env, importPath);
env.setupEnglishOutput();
cmake.setEnvironment(env);
cmake.setTimeOutMessageBoxEnabled(false);
const FilePath cmakeExecutable = FilePath::fromString(configurePreset.cmakeExecutable.value());
QStringList args;
args.emplace_back("-S");
args.emplace_back(importPath.path());
@@ -428,7 +428,7 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
return preset.name == presetName;
});
Environment env = Environment::systemEnvironment();
Environment env = projectDirectory().deviceEnvironment();
CMakePresets::Macros::expand(configurePreset, env, projectDirectory());
if (configurePreset.displayName)

View File

@@ -280,7 +280,7 @@ bool evaluatePresetCondition(const PresetType &preset, const Utils::FilePath &so
if (!preset.condition)
return true;
Utils::Environment env = Utils::Environment::systemEnvironment();
Utils::Environment env = sourceDirectory.deviceEnvironment();
expand(preset, env, sourceDirectory);
PresetsDetails::Condition condition = preset.condition.value();