forked from qt-creator/qt-creator
ProjectImporter: Move logic to select preferred target into base class
That way the code can be reused in other importers later. Change-Id: I6318f9c959b73b2af2692408b918eb1fab715137 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -33,9 +33,7 @@
|
||||
#include "qmakestep.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
@@ -249,28 +247,6 @@ QStringList QmakeProjectImporter::importCandidates()
|
||||
return candidates;
|
||||
}
|
||||
|
||||
Target *QmakeProjectImporter::preferredTarget(const QList<Target *> &possibleTargets)
|
||||
{
|
||||
// Select active target
|
||||
// a) The default target
|
||||
// b) Simulator target
|
||||
// c) Desktop target
|
||||
// d) the first target
|
||||
Target *activeTarget = possibleTargets.isEmpty() ? 0 : possibleTargets.at(0);
|
||||
int activeTargetPriority = 0;
|
||||
foreach (Target *t, possibleTargets) {
|
||||
BaseQtVersion *version = QtKitInformation::qtVersion(t->kit());
|
||||
if (t->kit() == KitManager::defaultKit()) {
|
||||
activeTarget = t;
|
||||
activeTargetPriority = 3;
|
||||
} else if (activeTargetPriority < 1 && version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)) {
|
||||
activeTarget = t;
|
||||
activeTargetPriority = 1;
|
||||
}
|
||||
}
|
||||
return activeTarget;
|
||||
}
|
||||
|
||||
static ToolChain *preferredToolChain(BaseQtVersion *qtVersion, const FileName &ms, const QMakeStepConfig::TargetArchConfig &archConfig)
|
||||
{
|
||||
const FileName spec = ms.isEmpty() ? qtVersion->mkspec() : ms;
|
||||
|
||||
Reference in New Issue
Block a user