From da7c25e8da3a41e076506eda2f050af452bf36c5 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 23 Aug 2023 11:51:30 +0200 Subject: [PATCH] CMake: Do not print warning if no run device is set With an iOS kit, there is no run device set if no device is connected, which triggered an assert. Change-Id: I9c435c618daab2601973372efb84f9ddbe9c5998 Reviewed-by: hjk Reviewed-by: --- .../cmakeprojectmanager/cmakebuildstep.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index f52db4b6912..11b3d88dcd4 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -184,15 +184,16 @@ static QString initialStagingDir(Kit *kit) static bool supportsStageForInstallation(const Kit *kit) { IDeviceConstPtr runDevice = DeviceKitAspect::device(kit); + Id runDeviceType = DeviceTypeKitAspect::deviceTypeId(kit); IDeviceConstPtr buildDevice = BuildDeviceKitAspect::device(kit); - QTC_ASSERT(runDevice, return false); + QTC_ASSERT(runDeviceType.isValid(), return false); QTC_ASSERT(buildDevice, return false); - return runDevice->id() != buildDevice->id() - && runDevice->type() != Android::Constants::ANDROID_DEVICE_TYPE - && runDevice->type() != Ios::Constants::IOS_DEVICE_TYPE - && runDevice->type() != Ios::Constants::IOS_SIMULATOR_TYPE - && runDevice->type() != BareMetal::Constants::BareMetalOsType - && runDevice->type() != WebAssembly::Constants::WEBASSEMBLY_DEVICE_TYPE; + return (!runDevice || runDevice->id() != buildDevice->id()) + && runDeviceType != Android::Constants::ANDROID_DEVICE_TYPE + && runDeviceType != Ios::Constants::IOS_DEVICE_TYPE + && runDeviceType != Ios::Constants::IOS_SIMULATOR_TYPE + && runDeviceType != BareMetal::Constants::BareMetalOsType + && runDeviceType != WebAssembly::Constants::WEBASSEMBLY_DEVICE_TYPE; } CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) :