From cca7bc98a9b031e5454406f33a42edae61d44dbe Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 24 Oct 2023 09:15:02 +0200 Subject: [PATCH] CMake: Fix deployment path Previously the path would be created based on the build device instead of the target device. Therefore when building on windows with a linux target the path might become "c:\usr\bin\..." instead of "/usr/bin/...". Fixes: QTCREATORBUG-29797 Change-Id: I13a9941b87b863f3e1b8420bcab230db1f70a28b Reviewed-by: Reviewed-by: David Schulz --- .../cmakeprojectmanager/cmakebuildstep.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 31a6ae23c02..370799fe260 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -775,22 +775,23 @@ void CMakeBuildStep::updateDeploymentData() DeploymentData deploymentData; deploymentData.setLocalInstallRoot(rootDir); - IDeviceConstPtr device = BuildDeviceKitAspect::device(buildSystem()->kit()); + IDeviceConstPtr runDevice = DeviceKitAspect::device(buildSystem()->kit()); const auto appFileNames = transform>(buildSystem()->applicationTargets(), [](const BuildTargetInfo &appTarget) { return appTarget.targetFilePath.fileName(); }); - auto handleFile = [&appFileNames, rootDir, &deploymentData, device](const FilePath &filePath) { - const DeployableFile::Type type = appFileNames.contains(filePath.fileName()) - ? DeployableFile::TypeExecutable - : DeployableFile::TypeNormal; + auto handleFile = + [&appFileNames, rootDir, &deploymentData, runDevice](const FilePath &filePath) { + const DeployableFile::Type type = appFileNames.contains(filePath.fileName()) + ? DeployableFile::TypeExecutable + : DeployableFile::TypeNormal; - FilePath targetDirPath = filePath.parentDir().relativePathFrom(rootDir); + FilePath targetDirPath = filePath.parentDir().relativePathFrom(rootDir); - const FilePath targetDir = device->rootPath().pathAppended(targetDirPath.path()); - deploymentData.addFile(filePath, targetDir.nativePath(), type); - return IterationPolicy::Continue; - }; + const FilePath targetDir = runDevice->rootPath().pathAppended(targetDirPath.path()); + deploymentData.addFile(filePath, targetDir.nativePath(), type); + return IterationPolicy::Continue; + }; rootDir.iterateDirectory(handleFile, {{}, QDir::Files | QDir::Hidden, QDirIterator::Subdirectories});