From fb063a09bea0046c7ac72b9fc4d8fb563cfed06d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 11 Sep 2017 15:47:35 +0200 Subject: [PATCH] AutoTest: Be more correct when gathering buildsystem targets This avoids taking too many buildsystem targets into account. On the downside this breaks execution of several possible project layouts. Change-Id: Ia7bf00d11a3e7c9bf362667e33b1d1542495db4a Reviewed-by: Oliver Wolff --- src/plugins/autotest/gtest/gtesttreeitem.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/autotest/gtest/gtesttreeitem.cpp b/src/plugins/autotest/gtest/gtesttreeitem.cpp index 92d24bc5a39..6828d4aa78d 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.cpp +++ b/src/plugins/autotest/gtest/gtesttreeitem.cpp @@ -29,6 +29,7 @@ #include #include +#include #include namespace Autotest { @@ -293,11 +294,16 @@ QSet GTestTreeItem::internalTargets() const QSet result; const auto cppMM = CppTools::CppModelManager::instance(); const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject()); + const QString file = filePath(); for (const CppTools::ProjectPart::Ptr projectPart : projectInfo.projectParts()) { if (projectPart->buildTargetType != CppTools::ProjectPart::Executable) continue; - if (projectPart->projectFile == proFile()) + if (projectPart->projectFile == proFile() + && Utils::anyOf(projectPart->files, [&file] (const CppTools::ProjectFile &pf) { + return pf.path == file; + })) { result.insert(projectPart->buildSystemTarget + '|' + projectPart->projectFile); + } } return result; }