Include directory search paths not detected in CMake project - Visual Studio 2019 and Resharper C++ 2019.1.3

Hey,

So I'm using Visual Studio 2019 with the build-in CMake project type support. In my root CMakeLists.txt file I make use of target_include_directories commands to add search paths for library headers.

This works absolutely fine using standard Visual Studio, with it's own intellisense being able to detect the search paths and find the includes.

However, Resharper C++ seems to be completely unable to figure it out. I get both unknown type errors and errors for not being able to find the include files at the specified paths, and examining the search paths it uses I can see that none of the ones from my CMakeLists.txt file is there.

What's going on with this? Is this a known issue or have I somehow misconfigured something incorrectly? Sort of annoying having to waste time with commercial tooling on such basic functionality that just works out of the box in Visual Studio...

Then again I am a CMake newbie, so perhaps I've done something that VS has just gracefully let me do. Again, this works without problems when using standard VS without Resharper C++ enabled.

2 comments
Comment actions Permalink

Hello!

Which version of Visual Studio are you using? VS 16.2/16.3 sometimes do not give R++ correct project properties on a CMake solution until CMake cache is regenerated. We're trying to resolve this, the tracking issue is https://youtrack.jetbrains.com/issue/RSCPP-26513

We'd appreciate if you could try the latest 2019.2 build from https://www.jetbrains.com/resharper/eap/ and check if include paths are correct after CMake cache is regenerated.

0
Comment actions Permalink

A small update - 2019.2 EAP 6 should have a workaround for include paths. Other compilation properties which we get from the compilation command-line provided by Visual Studio will be still broken.

The same issue affects Visual Studio's own IntelliSense, and Microsoft acknowledges this. I've filed a VS issue for this -https://developercommunity.visualstudio.com/content/problem/664611/intellisense-errors-in-a-cmake-project-when-the-pr.html. All in all, CMake support in Visual Studio is still not very stable, consider using the traditional VS projects in the meantime as a workaround.

0

Please sign in to leave a comment.