Qt Creator Clang Tools: can't analyze a header file
-
It was reported https://bugreports.qt.io/browse/QTCREATORBUG-28638:
Clang Tools analysis of a C(++) header is impossible with Qt Creator - the error is shown in Issues pane:
:-1: error: Cannot analyze current file: "/home/bam/kde/src/kwin/src/main.h" is not a known source file.
The same file can be analyzed with CLI Clang-Tidy just fine.
Tried on CMake-based KWin project:
https://invent.kde.org/plasma/kwinTo reproduce:
right-click on the header source, from the context menu choose Analyze Current File item -
Qt Creator requires header files to be part of
target_sources
. As you can see at src/CMakeLists.txt · master · Plasma / KWin · GitLab (kde.org) there is nomain.h
there, only the cpp file.See Qt Creator 6 - CMake update for more details.
-
Thank you.
I provided a KWin patch to address this, let's see what colleagues say:
https://invent.kde.org/plasma/kwin/-/merge_requests/3400