CMake: Use the OS of the source directory as ${hostSystemName}

In case of building on a remote system  CMake considers this remote system
as host.

Change-Id: Ifb9d0b2a2c4c49ba4ee009795f5b432c7b951e0d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
hjk
2022-10-18 15:09:40 +02:00
parent 471b036803
commit d47a72e26c

View File

@@ -10,10 +10,8 @@
namespace CMakeProjectManager::Internal::CMakePresets::Macros { namespace CMakeProjectManager::Internal::CMakePresets::Macros {
QString getHostSystemName() static QString getHostSystemName(Utils::OsType osType)
{ {
Utils::OsType osType = Utils::HostOsInfo::hostOs();
switch (osType) { switch (osType) {
case Utils::OsTypeWindows: case Utils::OsTypeWindows:
return "Windows"; return "Windows";
@@ -29,7 +27,7 @@ QString getHostSystemName()
return "Other"; return "Other";
} }
void expandAllButEnv(const PresetsDetails::ConfigurePreset &preset, static void expandAllButEnv(const PresetsDetails::ConfigurePreset &preset,
const Utils::FilePath &sourceDirectory, const Utils::FilePath &sourceDirectory,
QString &value) QString &value)
{ {
@@ -43,10 +41,10 @@ void expandAllButEnv(const PresetsDetails::ConfigurePreset &preset,
if (preset.generator) if (preset.generator)
value.replace("${generator}", preset.generator.value()); value.replace("${generator}", preset.generator.value());
value.replace("${hostSystemName}", getHostSystemName()); value.replace("${hostSystemName}", getHostSystemName(sourceDirectory.osType()));
} }
void expandAllButEnv(const PresetsDetails::BuildPreset &preset, static void expandAllButEnv(const PresetsDetails::BuildPreset &preset,
const Utils::FilePath &sourceDirectory, const Utils::FilePath &sourceDirectory,
QString &value) QString &value)
{ {
@@ -59,7 +57,7 @@ void expandAllButEnv(const PresetsDetails::BuildPreset &preset,
value.replace("${presetName}", preset.name); value.replace("${presetName}", preset.name);
} }
QString expandMacroEnv(const QString &macroPrefix, static QString expandMacroEnv(const QString &macroPrefix,
const QString &value, const QString &value,
const std::function<QString(const QString &)> &op) const std::function<QString(const QString &)> &op)
{ {