CMake: Convert paths to device

The values coming from a CMakeConfig do not contain
the device they are relative to.
This transforms the FilePath to be relative to the device
that the cmake executable was run on.

Change-Id: I7bfdf065ddb4acfc751ac6456f1c32398393e2ad
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2022-09-29 10:00:53 +02:00
parent 7ec2e724fe
commit 1b1fc43954

View File

@@ -1156,6 +1156,7 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
const ToolChain *const tcC = ToolChainKitAspect::cToolChain(k); const ToolChain *const tcC = ToolChainKitAspect::cToolChain(k);
const ToolChain *const tcCxx = ToolChainKitAspect::cxxToolChain(k); const ToolChain *const tcCxx = ToolChainKitAspect::cxxToolChain(k);
const CMakeConfig config = configuration(k); const CMakeConfig config = configuration(k);
const CMakeTool *const cmake = CMakeKitAspect::cmakeTool(k);
const bool isQt4 = version && version->qtVersion() < QVersionNumber(5, 0, 0); const bool isQt4 = version && version->qtVersion() < QVersionNumber(5, 0, 0);
FilePath qmakePath; // This is relative to the cmake used for building. FilePath qmakePath; // This is relative to the cmake used for building.
@@ -1167,11 +1168,11 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
const FilePath expandedValue const FilePath expandedValue
= FilePath::fromString(k->macroExpander()->expand(QString::fromUtf8(i.value))); = FilePath::fromString(k->macroExpander()->expand(QString::fromUtf8(i.value)));
if (i.key == CMAKE_QMAKE_KEY) if (i.key == CMAKE_QMAKE_KEY)
qmakePath = expandedValue; qmakePath = expandedValue.onDevice(cmake->cmakeExecutable());
else if (i.key == CMAKE_C_TOOLCHAIN_KEY) else if (i.key == CMAKE_C_TOOLCHAIN_KEY)
tcCPath = expandedValue; tcCPath = expandedValue.onDevice(cmake->cmakeExecutable());
else if (i.key == CMAKE_CXX_TOOLCHAIN_KEY) else if (i.key == CMAKE_CXX_TOOLCHAIN_KEY)
tcCxxPath = expandedValue; tcCxxPath = expandedValue.onDevice(cmake->cmakeExecutable());
else if (i.key == CMAKE_PREFIX_PATH_KEY) else if (i.key == CMAKE_PREFIX_PATH_KEY)
qtInstallDirs = CMakeConfigItem::cmakeSplitValue(expandedValue.path()); qtInstallDirs = CMakeConfigItem::cmakeSplitValue(expandedValue.path());
} }