0

I have a C++ project which uses CMake as a build system.

Upstream recently refactored the code, moving most of the project’s own code to a subdirectory. For example, foo/foo_base.hpp is now in subdir/foo/foo_base.hpp. Some subdirectories did not get refactored: deps, which holds third-party dependencies, is still deps and not subdir/deps.

#include directives have not changed. The above file would be included as #include "foo/foo_base.hpp" both before and after the refactoring.

CMakeFiles.txt got updated, so the project still builds as it did before.

However, Qt Creator has problems resolving dependencies in moved files. If subdir/bar/bar.cpp (formerly bar/bar.cpp) has #include "foo/foo_base.cpp", Qt Creator complains about the file not being found, and none of the code analysis features (e.g. jumping to the corresponding declaration) works any more.

The project was imported into Qt Creator using New Project > Import Project > Import Existing Project. That is, it is not a QMake project and there is no .pro file.

The Qt docs mention editing the project’s .includes file, but adding subdir there causes Qt Creator to crash on opening the project.

How can I tell Qt Creator to use $PROJECT_ROOT/subdir instead of (or in addition to) $PROJECT_ROOT when resolving relative includes?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.