forked from qt-creator/qt-creator
CMake: Add heuristics to set "Run in Terminal" flag
For CMake file-api, flag all applications not linking to "QtXGui" as "Run in Terminal". Task-number: QTCREATORBUG-21451 Change-Id: I29f086c546d3d8a9f56257e423602f787db42ccd Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -554,6 +554,7 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
|
|||||||
bti.projectFilePath = ct.sourceDirectory.stringAppended("/");
|
bti.projectFilePath = ct.sourceDirectory.stringAppended("/");
|
||||||
bti.workingDirectory = ct.workingDirectory;
|
bti.workingDirectory = ct.workingDirectory;
|
||||||
bti.buildKey = ct.title;
|
bti.buildKey = ct.title;
|
||||||
|
bti.usesTerminal = !ct.linksToQtGui;
|
||||||
|
|
||||||
// Workaround for QTCREATORBUG-19354:
|
// Workaround for QTCREATORBUG-19354:
|
||||||
bti.runEnvModifier = [this](Environment &env, bool) {
|
bti.runEnvModifier = [this](Environment &env, bool) {
|
||||||
|
@@ -53,6 +53,7 @@ public:
|
|||||||
QString title;
|
QString title;
|
||||||
Utils::FilePath executable; // TODO: rename to output?
|
Utils::FilePath executable; // TODO: rename to output?
|
||||||
TargetType targetType = UtilityType;
|
TargetType targetType = UtilityType;
|
||||||
|
bool linksToQtGui = false;
|
||||||
Utils::FilePath workingDirectory;
|
Utils::FilePath workingDirectory;
|
||||||
Utils::FilePath sourceDirectory;
|
Utils::FilePath sourceDirectory;
|
||||||
Utils::FilePath makeCommand;
|
Utils::FilePath makeCommand;
|
||||||
|
@@ -256,6 +256,17 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|
|||||||
extractBacktraceInformation(t.backtraceGraph, sourceDir, id.backtrace, 500));
|
extractBacktraceInformation(t.backtraceGraph, sourceDir, id.backtrace, 500));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Is this a terminal application?
|
||||||
|
if (ct.targetType == ExecutableType && t.link && t.link.value().language == "CXX") {
|
||||||
|
for (const FragmentInfo &f : t.link.value().fragments) {
|
||||||
|
if (f.role != "libraries")
|
||||||
|
continue;
|
||||||
|
if (f.fragment.contains("QtGui") || f.fragment.contains("Qt5Gui")
|
||||||
|
|| f.fragment.contains("Qt6Gui"))
|
||||||
|
ct.linksToQtGui = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ct;
|
return ct;
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user