CMake: Extract and show more CMake location information for targets

Report more cmake file locations that are relevant to a target in
the "Open..." menu entry in the target's context menu.

This information is extracted from the backtrace information that
is provided by fileapi.

Change-Id: I01659a6cc7254cd0ef6b533a0785d2f15d31c3c6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tobias Hunger
2019-07-26 13:57:24 +02:00
parent 9ae4510e27
commit 4aee38e04c
4 changed files with 115 additions and 76 deletions

View File

@@ -368,8 +368,10 @@ QList<CMakeBuildTarget> BuildDirManager::takeBuildTargets(QString &errorMessage)
// Guess at the target definition position when no details are known
for (CMakeBuildTarget &t : readerTargets) {
if (t.definitionFile.isEmpty()) {
t.definitionFile = t.sourceDirectory.pathAppended("CMakeLists.txt");
if (t.backtrace.isEmpty()) {
t.backtrace.append(
FolderNode::LocationInfo(tr("CMakeLists.txt in source directory"),
t.sourceDirectory.pathAppended("CMakeLists.txt")));
}
}
result.append(readerTargets);