forked from qt-creator/qt-creator
CMakePM: Jump to function/macro/option definitions in CMake editor
Fixes: QTCREATORBUG-25523 Change-Id: If9ab6651a858e5fa08e8a1c321cb1f757831e14a Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -1141,6 +1141,7 @@ void CMakeBuildSystem::handleParsingSucceeded(bool restoredFromBackup)
|
||||
});
|
||||
m_buildTargets += m_reader.takeBuildTargets(errorMessage);
|
||||
m_cmakeFiles = m_reader.takeCMakeFileInfos(errorMessage);
|
||||
setupCMakeSymbolsHash();
|
||||
|
||||
checkAndReportError(errorMessage);
|
||||
}
|
||||
@@ -1245,6 +1246,29 @@ void CMakeBuildSystem::wireUpConnections()
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeBuildSystem::setupCMakeSymbolsHash()
|
||||
{
|
||||
m_cmakeSymbolsHash.clear();
|
||||
|
||||
for (const auto &cmakeFile : std::as_const(m_cmakeFiles)) {
|
||||
for (const auto &func : cmakeFile.cmakeListFile.Functions) {
|
||||
if (func.LowerCaseName() != "function" && func.LowerCaseName() != "macro"
|
||||
&& func.LowerCaseName() != "option")
|
||||
continue;
|
||||
|
||||
if (func.Arguments().size() == 0)
|
||||
continue;
|
||||
auto arg = func.Arguments()[0];
|
||||
|
||||
Utils::Link link;
|
||||
link.targetFilePath = cmakeFile.path;
|
||||
link.targetLine = arg.Line;
|
||||
link.targetColumn = arg.Column - 1;
|
||||
m_cmakeSymbolsHash.insert(QString::fromUtf8(arg.Value), link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeBuildSystem::ensureBuildDirectory(const BuildDirParameters ¶meters)
|
||||
{
|
||||
const FilePath bdir = parameters.buildDirectory;
|
||||
|
||||
Reference in New Issue
Block a user