From 2387e9e37aeb5b4acf6b2b1bdb1f8f047e23c1d4 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 16 Jun 2023 21:47:39 +0200 Subject: [PATCH] CMakeProjectManager: Deselect "Stage for installation" for Android/iOS The "Stage for installation" option in the CMake build step, which is introduced with Qt Creator 11, relies on the presence of an "install" CMake target. The build systems of Qt for Android and Qt for iOS do not create an "install" CMake target. Therefore, a pre-selected "Stage for installation" option in the CMake build step would cause a build failure. This change deselects the option if the kit's run device is of type Android or iOS. Fixes: QTCREATORBUG-29293 Change-Id: I9755dea1564fbc2696f8bdd416f637c5b28e3761 Reviewed-by: hjk --- src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index d8c51fcbd3d..9e4a705fb54 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -12,6 +12,10 @@ #include "cmakeprojectmanagertr.h" #include "cmaketool.h" +#include + +#include + #include #include #include @@ -173,13 +177,15 @@ static QString initialStagingDir(Kit *kit) return QString::fromUtf8("/tmp/Qt-Creator-staging-" + ba); } -static bool buildAndRunOnSameDevice(Kit *kit) +static bool supportsStageForInstallation(const Kit *kit) { IDeviceConstPtr runDevice = DeviceKitAspect::device(kit); IDeviceConstPtr buildDevice = BuildDeviceKitAspect::device(kit); QTC_ASSERT(runDevice, return false); QTC_ASSERT(buildDevice, return false); - return runDevice->id() == buildDevice->id(); + return runDevice->id() != buildDevice->id() + && runDevice->type() != Android::Constants::ANDROID_DEVICE_TYPE + && runDevice->type() != Ios::Constants::IOS_DEVICE_TYPE; } CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) : @@ -198,7 +204,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) : m_useStaging = addAspect(); m_useStaging->setSettingsKey(USE_STAGING_KEY); m_useStaging->setLabel(Tr::tr("Stage for installation"), BoolAspect::LabelPlacement::AtCheckBox); - m_useStaging->setDefaultValue(!buildAndRunOnSameDevice(kit())); + m_useStaging->setDefaultValue(supportsStageForInstallation(kit())); m_stagingDir = addAspect(); m_stagingDir->setSettingsKey(STAGING_DIR_KEY);