CMakePM: Handle project FindPackage package variables

For example find_package(ZLIB QUEIT) will result in the package
variables ZLIB_LIBRARY ZLIB_INCLUDE_DIR.

The variables are available for both code completion and navigation.

Change-Id: I4ea6090f44a980dc91632fcabbda16987b0f0285
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2023-09-27 20:20:46 +02:00
parent d08f1c6e94
commit 776c8670d7
4 changed files with 56 additions and 0 deletions

View File

@@ -248,6 +248,10 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// Check if the symbols is a user defined function or macro
const CMakeBuildSystem *cbs = static_cast<const CMakeBuildSystem *>(bs);
// Strip variable coating
if (buffer.startsWith("${") && buffer.endsWith("}"))
buffer = buffer.mid(2, buffer.size() - 3);
if (cbs->cmakeSymbolsHash().contains(buffer)) {
link = cbs->cmakeSymbolsHash().value(buffer);
addTextStartEndToLink(link);