If you add a header to a CMake target explicitly via target_sources, the clang code model does not search that target's include paths when resolving any other files the header includes.
If the header isn't explicitly added (so that it appears under <Headers> after being found implicitly) it does get the correct include search paths applied.
The explicit case worked in 4.2
See attached project:
If the project is opened as is,
in foo.h is flagged up by the clang code model (although it builds fine)
if you remove "include/testlib/foo.h" from the sources listed in testlib/CMakeLists.txt, foo.h moves from the testlib target to the <Headers> section.
#include "testlib/bar.h" is no longer highlighted as an error by the Clang code model.
Note that for the error case, if you open the C++ code model inspector, there does exist a context with the correct include paths, but it's not one of those listed in the parse contexts drop-down for foo.h, so it can't be selected.
|For Gerrit Dashboard: QTCREATORBUG-17971|
|192214,2||CMake: Fix up file group information in server-mode||4.3||qt-creator/qt-creator||Status: MERGED||+2||0|