Projects: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*

And instead of qgetenv.
Takes Qt Creator's setting at "Environment > System > Environment" into
account, which makes it easier on some platforms to set them (e.g.
macOS), can be configured differently in different settings paths, and
potentially can be changed at runtime (depending on usage).

Change-Id: I2217f13336ec816d28bd447ccd14a405bff2a3a7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Eike Ziller
2022-08-24 14:56:40 +02:00
parent c0f2fb9981
commit 904c368858
13 changed files with 44 additions and 33 deletions

View File

@@ -53,9 +53,9 @@ static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
path = Utils::filteredUnique(path);
if (HostOsInfo::isWindowsHost()) {
for (auto envVar : {"ProgramFiles", "ProgramFiles(x86)", "ProgramW6432"}) {
if (qEnvironmentVariableIsSet(envVar)) {
const QString progFiles = qEnvironmentVariable(envVar);
for (const auto &envVar : QStringList{"ProgramFiles", "ProgramFiles(x86)", "ProgramW6432"}) {
if (qtcEnvironmentVariableIsSet(envVar)) {
const QString progFiles = qtcEnvironmentVariable(envVar);
path.append(FilePath::fromUserInput(progFiles + "/CMake"));
path.append(FilePath::fromUserInput(progFiles + "/CMake/bin"));
}