Details
-
Bug
-
Resolution: Done
-
P2: Important
-
Qt Creator 4.3.0-beta1, Qt Creator 4.3.0-rc1
-
OSX 10.11.6
Description
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,
#include "testlib/bar.h"
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.